Config refactor. Plugins now using config

This commit is contained in:
Hash Borgir
2024-02-14 00:12:40 -07:00
parent 2277dd1b90
commit bb331092d0
17 changed files with 33 additions and 877 deletions

View File

@@ -60,11 +60,9 @@ creds = botlib.Creds(MATRIX_URL, MATRIX_USER, MATRIX_PASS)
config = FunguyConfig()
bot = botlib.Bot(creds, config)
PREFIX = config.prefix
@bot.listener.on_message_event
async def handle_commands(room, message):
match = botlib.MessageMatch(room, message, bot, PREFIX)
match = botlib.MessageMatch(room, message, bot, config.prefix)
if match.is_not_from_this_bot() and match.prefix() and match.command("reload"):
if str(message.sender) == config.admin_user:
reload_plugins()
@@ -73,7 +71,7 @@ async def handle_commands(room, message):
await bot.api.send_text_message(room.room_id, "You are not authorized to reload plugins.")
for plugin_name, plugin_module in PLUGINS.items():
await plugin_module.handle_command(room, message, bot, PREFIX, config)
await plugin_module.handle_command(room, message, bot, config.prefix, config)
if match.is_not_from_this_bot() and match.prefix() and match.command("rehash"):