ChatChain: A ChatServices linking API

in #utopian-io5 years ago

https://github.com/ldtteam/chatchain (branch: rewrite)

Hi, there. Recently I was asked by a friend of mine to make a post about the project I'm working on here. Here it goes:

ChatChain is an open source project that I started working on (properly) about 3 months ago. The aim of the project is to provide a generic web API for linking various (text) chat services (and game chats) together in more dynamic ways than is currently available. At the present time, most forms of linking chat services together are only available in a 1 to 1 form (e.g. between Discord and IRC) -- I hope to change this in an efficient and elegant manner.

Project Structure:

The project currently is using Microsoft's ASP.NET Core framework (v2.2) and consists of 3 main parts:

  • A SignalR hub implementation which is the API that clients send and receive messages from. <- henceforth referred to as the Hub
  • An IdentityServer4 implementation which is used to provide authorization to the clients for the hub. <- henceforth referred to as the IS4 Server
  • A simple Razor WebApp which is used as a frontend to manage Clients and Groups, and uses .NET Core Identity for the users within. <- henceforth referred to as the WebApp

All parts of this project have been made to integrate with a MongoDB instance for data storage, and a Redis server for intercommunication when scaled out or load balanced. The WebApp is currently only functional, and is ugly and full of default information and CSS/HTML.

With the above in mind, we move on to a few components of the API/service. Currently we have 3 main components, Clients, Groups and Users.

  • Clients are what connect to the Hub and relay the various messages to and from the Chat service or game they are created for. (E.G. a Discord Bot)
  • Groups you can think of as Channels, they are simply groups of Clients. A client may have many groups.
  • Users are as you might expect, the various people (or bots) sending messages on a Chat service.

Current Status:

Most of the server is done other than the specific Hub methods, I am currently working on two clients, one for Discord and one for Minecraft. ScreenShot
I have been able to create methods for relaying Generic Messages and Client Events (connecting/disconnecting/etc). I am now working on User Events, such as Connecting, Disconnecting, Death, Banning, Kicking and Achievements.

Planned Clients:

  • Discord
  • Slack
  • IRC
  • Minecraft

~ feel free to suggest any other platforms (with bot/modding capabilities) to add!

Planned Features

  • An API for the WebApp for easier management.

I'd like this to be a simple REST api that would allow people to add, remove and create both clients and groups.

  • Server-Side plugin capabilities, such as a centralized Swear Filter

The first step for this would be a way to load plugins (maybe lua? or otherwise .dll files). (This Might Help)
after that would be to setup events that in the hub that plugins could use to edit messages or other hub methods to their liking.

  • A Better WebApp UI (Would love some help!)

I'd like to make the WebApp actually presentable, I'm thinking of probably a darker colour scheme, and just a generally better layout. I'm pretty sure almost anything is better than the current state of the UI (sadly)

  • User Storage

A way to store the various users on different clients, and be able to keep things like join/leave dates and other simple information. This will also be important for the next feature.

  • Link users together

A way to be able to link a person's various chat service users together, this would allow for things like making chat use the user's service specific username (and profile picture) instead of whichever username is used on the sending client.

  • Commands Relaying

If you ban a user on one chat service, you probably want them banned everywhere right? well this would be what would make that possible, among other things this would also allow you to run bot commands on other clients, and even game commands from a chat

  • Permission Management (for Command Relaying)

The above feature is only useful if only the appropriate people can use it, but sadly each and every different chat service or game has its own permissions style, etc. This feature would allow for a hopefully simple way to bridge those together, my thoughts on this are making groups of users (a user can have multiple groups) which signify permission levels, these groups are then mapped on each client to their client's respective permissions.

Sort:  

Thank you for your contribution. Despiste you are working on your branch rewrite which hasn't been merged yet to the master branch, I would like to give a few cents of my review.

  1. I notice that your commit messages are sort-of testingXXX - which doesn't really give much information.
  2. I haven't see any existing unit tests, nor the new tests added while you make changes - which is a bit concern.
  3. Code not needed should really be deleted instead of commenting-out. For example, here you commented out code, which is hard to understand without comments and especially the commit messages are not descriptive.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

Hi there, thanks a tonne for your input, currently i've been trying mostly to get to a release point before i go through and cleanup all my code (which would be when i PR the rewrite branch in to the Master branch).

One of the things that i've never quite understood is Unit Testing, i'm mostly self taught for the past 4/5 years and my testing is always done by actually attempting to use the service/program instead of using these. in my personal opinion Unit testing is generally more of a preference rather than a need.

Yes i really need to remove those blocks of commented out code, i'm actually going to do that right now

Also on that note, the names of the commits i'm quite aware are horrible, the only reason i am committing them is to push them to our build system so i can test them easily. and with the amount of times i need to do that, i generally can't be bothered naming them.
but i definitely will be properly naming them once i get to a release point and need a lot less commits for testing

I did a cleanup for ya, not everything i want to cleanup, but that'll be done when i'm ready to merge it into Master (i'd like to go through and document everything before i merge)
https://github.com/ldtteam/ChatChain/commit/d33bf98e75923062e3f76a4fa8e0002f8c095e11

Thank you for your review, @justyy! Keep up the good work!

Welcome @asherslab! Since you are new I thought I'd give you some tips with regards to submitting posts to the development category.

First of all, commits and / or pull requests should've either been made to, or merged into the main branch. It's obviously best to have a pull request that you can just link to in the body of your post, as that makes it easier for you and whoever ends up reviewing it.

Lastly, I recommend reading this guide on how to achieve a higher score in the development category, as it includes a lot of helpful tips. You could also think about submitting posts to the blog category, as that can just be about the project in general, and doesn't need to be tied to any pull request.

Anyway, it's very nice to have you and I hope you stick around! If you have any questions don't hesitate to ask (either here or on Discord, for example).

Hi @asherslab!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Congratulations @asherslab! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published your First Post
You received more than 10 upvotes. Your next target is to reach 50 upvotes.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Carnival Challenge - Collect badge and win 5 STEEM
Vote for @Steemitboard as a witness and get one more award and increased upvotes!

Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 7 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.

I upvoted your contribution because to my mind your post is at least 4 SBD worth and should receive 100 votes. It's now up to the lovely Steemit community to make this come true.

I am TrufflePig, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, you can find an explanation here!

Have a nice day and sincerely yours,
trufflepig
TrufflePig

Hey, @asherslab!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Congratulations @asherslab! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 64222.08
ETH 3135.29
USDT 1.00
SBD 3.99