Commit graph

4 commits

Author SHA1 Message Date
22c9590816 Update help_command logic
The `help_command` method for each addon/the bot were not returning the
help message, but were instead sending the help messages themselves.
Update the logic to simply return the help message string.
2021-02-16 23:13:46 -05:00
69a22c8a22 Add help and listcommand logic
Both `!help` and `!listcommand` are handled by the bot itself, so take
advantage of how the addons method calls work to implement both
`matrix_command` and `help_command` on `self`.

Add `help_command` to each currently enabled and functional addon
2021-02-14 22:39:31 -05:00
6fe1a7a251 Update how Addons are used
After some more reading, update the logic for handling the addons.

Leverage an "addons module" (Addon), and require that each addon be a
class within that module. Within that class, optionally include a
`self.register` method, which will be called when the bot is
initialized. This method takes one parameter: the bot
instance.Registering the addon adds the bot's instance to an instance of
the addon, and vice versa, allowing the instances to communicate.
Additionally, registering adds the addons commands.

Each registered addon must also include a `matrix_command` method, which
takes the message String from Matrix. The intention here is to include
additional `*_command` methods for different protocols, without having
to change much else. Adding additional protocols will determine how well
that works.

chronicle_bot.rb: Redo addon logic (details above)
addons/utils.rb: Update for new addon logic (details above)
addons/roller.rb: Update for new addon logic (details above)
2021-02-14 21:06:46 -05:00
5938547e05 addons/roller: A capable die roller 2021-02-06 22:24:07 -05:00