HereComesTheMoon / TBotD

A simple Discord bot written for the TBD community on Discord.
GNU General Public License v3.0
2 stars 2 forks source link

Decouple from specific server #12

Open HereComesTheMoon opened 1 year ago

HereComesTheMoon commented 1 year ago

Currently TBotD is designed to run on TBD. This has good reasons, of course, but it would be nice to figure out how to reduce that dependency as much as possible, and to figure out where it still exists.

For example, the bot currently has the ability to add specific roles to users, and these roles are hardcoded TBD roles. It would probably be possible to remove this, and to instead store roles in a database. If the bot joins a server, these role values are empty. Then, an admin might be able to set them using a command.

For now the primary goal would be to figure out which parts of the bot are TBD specific at all, before discussing further changes.

HereComesTheMoon commented 1 year ago

Side note: Currently the Discord bot hardcodes data in config.ini as follows:

[tbd]
SERVER = _
CW_BAN_ROLE = _
BLINDED_ROLE = _
MUTED_ROLE = _
MOD_ROLE = _

LOGGER_CHANNEL = _
THREAD_WATCH_CHANNEL = _
BOT_CHANNEL = _

For now eliminating the entire category might be a bit too much to ask, though it'd be a noble goal. Instead all functionality using any of these IDs should be put into a single Cog. Better yet, if it's not necessary to use it, then just generalize the functionality to arbitrary servers.

These values are currently used to:

It seems like it should be possible to store some of this information in a database, allowing the admin to change it at runtime. Basically, we'd have a database which associates certain data to each server. E.g. each server may or may not have "thread_watch_channel" set or not.

SERVER is primarily used to check if we're on the right server. This can be removed by generalizing features to all servers. Currently if this check were removed, then a thread created on a different server might trigger thread_watch on TBD.