Skip to content

Extend AchoBot

Paula Santamaría edited this page Feb 14, 2022 · 1 revision

The project is designed to be easily extensible. It uses the command pattern to define the list of commands. You can extend this list using different strategies depending on what you aim to achieve:

1. Add more simple Text commands

To do this, simply add a new row in your Notion Database. The new command will be loaded the next time you start the service or if you call !refresh from the chat when the server is running (only the Broadcaster or Moderator can do this).

2. Add another source for commands

Suppose you don't want to use Notion and prefer to store your command somewhere else. In that case, you should build your own CommandLoader and include it when the TmiCommandManageris instantiated. A CommandLoader retrieves commands from anywhere and makes sure the commands fit the ITmiCommand contract. Take a look at NotionCommandsLoader to see a working example.

3. Add new built-in commands

Commands that require some logic (E.g: clearing the cache) should be included as a Built-in command.

  1. Create a new class that extends BaseTmiCommand and add your logic within the executeLogic method.
  2. Then include your command in the dictionary defined in BuiltInCommandsLoader.

Clone this wiki locally