feat(commands/bot): add help command and fix nested reloading

This commit is contained in:
2024-12-30 16:21:15 -05:00
parent d0402a58e9
commit e4af64fa99
6 changed files with 41 additions and 38 deletions

19
main.py
View File

@@ -1,11 +1,8 @@
import inspect
import time
import commands
import constants
import core
import events
import utils
from state import client, start_time
@@ -25,25 +22,9 @@ async def on_message_edit(before, after):
async def on_message(message):
await events.trigger_dynamic_handlers("on_message", message)
global reloaded_modules
if not message.content.startswith(constants.PREFIX):
return
if message.author.id in constants.OWNERS and commands.match(message.content) == [
commands.Command.RELOAD
]:
reloaded_modules = set()
for module in filter(
lambda v: inspect.ismodule(v)
and v.__name__ not in constants.RELOAD_BLACKLISTED_MODULES,
globals().values(),
):
core.rreload(reloaded_modules, module)
await utils.add_check_reaction(message)
return
await core.on_message(message)