A chatbot for the chat room #26

Closed
opened 2023-08-07 01:37:04 +00:00 by noah · 0 comments

It could be fun to program a chatbot for the chat room.

Some things it could do:

  • Have a "Robot Games" public channel where people could play group trivia games, hangman, or other fun activities with the chatbot.
  • If people DM it, it would be in regular chatbot mode and have conversations. They could ask it questions about the chat room or website and get automated answers (e.g.: how do I go on webcam?)
  • It could have some keyword triggers or commands in public rooms. Example, if someone shares too many pictures on the main channel to tell them to use the photo sharing channels.
  • It could auto-moderate the room, e.g. if somebody is spamming too rapidly to kick them from the room.

Some technical aspects:

  • Use RiveScript for its chatbot engine (of course)
  • The bot could set user variables so it knows when a message was sent in a public channel vs. a DM (the bot would be quieter in public channels as to not spam too much, but respond to every DM in direct chats)
  • If a user sends the bot an image over DM (since the bot might have chat admin status, and picture sharing is allowed in DMs with an admin), it could detect the <img tag and reply saying it doesn't have eyes to see it.
  • The bot engine would set the user's name variable to their chat nickname automatically.
  • Have a "reload" command to allow refreshing the bot's brain/functionality without fully turning it off and on again (so during development it doesn't need to exit/rejoin the room so many times).
  • It would have a user account on the website and have to log in with password to get the JWT token. It should have admin status with only chat moderation scopes.

Official support in BareRTC

To simplify the implementation, the BareRTC repo may as well include the chatbot as a first-class citizen.

It could be at cmd/chatbot/main.go and build as its own binary and have an API like:

  • chatbot init [path] to initialize a chatbot somewhere, default path being "./chatbot" in the git repo which would be git ignored. The folder would contain the config file, RiveScript replies, and everything else your bot needs - decoupled from where the chatbot binary lives!

On the BareRTC API, add an authentication endpoint for chatbots:

  • Using the Admin API Key as a shared secret to post to the endpoint
  • Endpoint would receive JSON of your JWT claims you want for the bot: username, admin, emoji
  • Endpoint would sign and return the JWT token, so you can authenticate directly with the WebSockets server.

The BareRTC repo would also provide the client websocket API.

Misc ideas what it could do

  • Unit conversion via emoji reactions
    • Emoji reactions on BareRTC can technically say anything I want, not just an emoji.
    • Example: if a user mentions a temperature in Celsius, put an emoji reaction that says the conversion in Fahrenheit and vice versa.
It could be fun to program a chatbot for the chat room. Some things it could do: * Have a "Robot Games" public channel where people could play group trivia games, hangman, or other fun activities with the chatbot. * If people DM it, it would be in regular chatbot mode and have conversations. They could ask it questions about the chat room or website and get automated answers (e.g.: how do I go on webcam?) * It could have some keyword triggers or commands in public rooms. Example, if someone shares too many pictures on the main channel to tell them to use the photo sharing channels. * It could auto-moderate the room, e.g. if somebody is spamming too rapidly to kick them from the room. Some technical aspects: * Use [RiveScript](https://www.rivescript.com) for its chatbot engine (of course) * The bot could set user variables so it knows when a message was sent in a public channel vs. a DM (the bot would be quieter in public channels as to not spam too much, but respond to every DM in direct chats) * If a user sends the bot an image over DM (since the bot might have chat admin status, and picture sharing is allowed in DMs with an admin), it could detect the `<img` tag and reply saying it doesn't have eyes to see it. * The bot engine would set the user's `name` variable to their chat nickname automatically. * Have a "reload" command to allow refreshing the bot's brain/functionality without fully turning it off and on again (so during development it doesn't need to exit/rejoin the room so many times). * It would have a user account on the website and have to log in with password to get the JWT token. It should have admin status with _only_ chat moderation scopes. ### Official support in BareRTC To simplify the implementation, the BareRTC repo may as well _include_ the chatbot as a first-class citizen. It could be at `cmd/chatbot/main.go` and build as its own binary and have an API like: * `chatbot init [path]` to initialize a chatbot somewhere, default path being "./chatbot" in the git repo which would be git ignored. The folder would contain the config file, RiveScript replies, and everything else your bot needs - decoupled from where the `chatbot` binary lives! On the BareRTC API, add an authentication endpoint for chatbots: * Using the Admin API Key as a shared secret to post to the endpoint * Endpoint would receive JSON of your JWT claims you want for the bot: username, admin, emoji * Endpoint would sign and return the JWT token, so you can authenticate directly with the WebSockets server. The BareRTC repo would also provide the client websocket API. ### Misc ideas what it could do * Unit conversion via emoji reactions * Emoji reactions on BareRTC can technically say anything I want, not just an emoji. * Example: if a user mentions a temperature in Celsius, put an emoji reaction that says the conversion in Fahrenheit and vice versa.
noah added the
enhancement
label 2023-08-07 01:37:04 +00:00
noah closed this issue 2024-01-21 01:01:55 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: nonshy/website#26
There is no content yet.