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

Use reactor model for flexible bot interaction #3

Open
2 of 10 tasks
wallabra opened this issue Jul 15, 2021 · 0 comments
Open
2 of 10 tasks

Use reactor model for flexible bot interaction #3

wallabra opened this issue Jul 15, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@wallabra
Copy link
Owner

wallabra commented Jul 15, 2021

triarc pre-1.0.0 is a monolithic codebase; there, Bot is inherited into subclasses, and commands are supplied thereby.

For 1.0.0, I'd rather Bot be able to function standalone, whereas a separate class, Reactor, would interact with it, registering commands and handling them, either in the same process or over RPC. This would effectively allow triarc to run standalone and without any code tailored for it specifically, with python -m triarc.bot.

If desired, a RPC listen port could be opened on which reactors could remotely plug. Alternatively, let the header of a triarc configuration file specify a reactor module.

User stories

  • A triarc configuration loads a reactor module which imports cobe and responds to messages by passing them as queries through it. This reactor tuns in the same Python process as the bot. The reactor plugging and unplugging is almost entirely transparent to the user.
  • A triarc configuration specifies a network address in localhost (or behind an Unix socket) instead, which points to a running reactor which is, in turn, the one using COBE. This means it can stay running even if the bot restarts.
  • A reactor interacts with a SQLite database. Multiple bots can plug themselves to it in order to talk to the reactor and use its functionality, which in turn accesses the data thread-safely.
  • Basic interface between bot and reactor
    • Reactor plugging and unplugging
    • Command registering and unregistering (incl. automatic unregister when reactor unplugs)
    • Broadcast command events to corresponding reactors
    • (optional) Low-level API for reactors
  • RPC reactor interface
    • (optional) Secure with password
  • Allow configuring reactor modules to load, and/or RPC listen hosts and ports for dynamic reactor loading (see Standard configuration for bot backends #2)
  • Redo the pingbot example using reactors
  • Write a basic reactor to allow interacting with the COBE chatbot through triarc
@wallabra wallabra added the enhancement New feature or request label Jul 15, 2021
@wallabra wallabra added this to the Release 1.0.0 milestone Jul 15, 2021
@wallabra wallabra self-assigned this Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant