feat(commands/bot): add help command and fix nested reloading
This commit is contained in:
19
main.py
19
main.py
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user