Connect Discord with your website!
This project is divided into 3 modules:
- Crossbar router
- Discord bot
- Web
Crossbar router handles the communication between Discord bot and web clients.
Discord bot "publishes" to the crossbar router when a message was posted in a text channel. A web client connects to the crossbar router and "subscribes". Anything that gets published is received by the web client.
When the web client wants to say something he does a Remote Procedure Call. Some information is passed such as username and message. The Discord Bot receives it, processes it and posts a message on behalf of the web client.
Basic knowledge about maintaining a VPS and working with Python and Node are required.
Start Crossbar router. See ReadMe in crossbar folder.
Start Discord bot. See ReadMe in bot folder.
Start the web server/deploy the web clients. See ReadMe in webclient folder.
Basic:
- Create Crossbar router
- Basic Crossbar router configuration
- Store message history
- Create the Discord bot
- OnMessage: Publish to Crossbar
- OnRPC: Send message
- Create the Website
- Subscribe to Crossbar
- OnEvent: visualize message
- Allow web clients to perform RPC
- Retrieve message history
Extended:
- Bot Authentication: Only authenticated Discord Bot can publish to Crossbar router
- Register domain, register certificate at Let's Encrypt, serve with https and wss.
- Optional web client authentication: Privileged users with secret token have more power
- Make it look good: Due to lack of experience on frontend: Help wanted!
- Markdown support
- Link formatting support
- Emoji support
- Discord syntax support (<@userid>, <#channel_id>, ...)
- Do pattern-based subscription
- Various crossbar topics see crossbar/crossbar_topics.md
- Use localStorage to save username, avatar URL, ...
- Connection recovery
- Microservices scaling
- Message history can't be retrieved: Message history is only implemented in pre-approved text channels. (See crossbar router config.)
The Discord Bot will broadcast all messages it has access to. If you don't want the message to be broadcasted, take away the read message right for the text channel.
This means anyone can read those messages if they have the technical know how of talking to my backend.
Anyone who is connected can post a chat message and there is no tracking who did it. There is no verification in place. A spammer could abuse this and send spam messages on behalf of the bot.
I plan on addressing those issues. Just bear in mind they exist when making use of this project which is still in its very early stage.
I plan on releasing a public bot that supports multiple servers. However for now I am solely focusing on a single server.
A public bot that allows anyone to chat in any registered server without any form of authentication is at risk of being used as a tool to spam.