Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Discord #19

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

feat: Add Discord #19

wants to merge 4 commits into from

Conversation

lalalune
Copy link
Collaborator

This PR adds a basic Discord client

  • This is event driven, so it starts up and responds to messages immediately on the message event
  • Probably want to have some shouldRespond handler or @ filtering to prevent spam
  • Could have other interactions like reactions, message edits, etc

@ayoubed
Copy link
Collaborator

ayoubed commented Dec 21, 2024

Love it, thanks Shawn

@MaxHuber888
Copy link
Collaborator

Thank you for the contribution @lalalune, apologies on the delay responding to this, we wanted to make sure we are integrating this in a way that makes sense. There will definitely be other connections/integrations where an event-listener loop is preferable to a single-thread step loop.

I took the listener loop out of the main loop for now and gave the discord action a "start-bot" and "stop-bot" action for controlling the listener loop. This also makes it easier to test. Eventually we can have any event listener loops like this one started alongside the main loop, but for now we should just control them using actions. This also allows the user to have, for example, a bot that spends 30 minutes responding to discord messages before going back to tweeting, etc. Generally makes things clean and configurable.

Remaining Issues:

  1. No "good" way to really monitor the listener loop, should prob have a check-bot-status action (although right now it just prints whenever it feels like it, which brings me to issue 2)
  2. Lots of messages all over the place, I think the parallel thread loop stuff is causing some issues for the cli lib. Need the parallel loop to be silent unless called into monitor mode (see issue 1), or figure something else out. Also need to make sure the messaging is consistent, and that we aren't spamming the user.
  3. A lot of things about this are hard-coded rn: the model pref is taken from config, the model provider is just the first in the list of model providers which are configured, and the system prompt is just a hard-coded string. Some of these are easier fixes than others.
  4. Perform_action method: there are differences between the abstract BaseConnection's implementation and the actual Connections, specifically in where kwargs is unpacked. I don't think there is any good reason for all the connections to have their own version of this function. We should decide which version we like and make that the BaseConnection's version, and then have all other connections inherit (this is not really related to Discord, just came up while working on this).
  5. Making the configuration more intuitive (adding how to add your bot to the server, so as to not confuse users) Can also look into programmatically creating the link needed to add the bot to the server, or linking to docs for configuring the bot.
  6. Stop-bot Action: does seem to stop the bot from responding, but also throws an error and then it says "Bot initialization complete" which makes no sense. Needs to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants