You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
989 B
20 lines
989 B
from importlib import reload
|
|
hooks = ["MESSAGE_CREATE"]
|
|
def run(event, ctx, bot):
|
|
if ctx["content"].startswith(":") and not(int(ctx["author"]["id"]) in bot.config["authed"]):
|
|
bot.send_msg(ctx["channel_id"], "you lack the proper authentication")
|
|
return
|
|
plugin_manager = bot.plugman
|
|
if ctx["content"].startswith(":reload"):
|
|
cmd = ctx["content"].split(" ")[1]
|
|
if not(cmd in [m.__name__ for m in plugin_manager.plugins_loaded]):
|
|
bot.send_msg(ctx["channel_id"], f"plugin {cmd} could not be found for reloading!")
|
|
else:
|
|
for m in plugin_manager.plugins_loaded:
|
|
if m.__name__ == cmd:
|
|
reload(m)
|
|
bot.send_msg(ctx["channel_id"], f"reloaded plugin {cmd}!")
|
|
bot.logger.write(f"reloaded {cmd}")
|
|
elif ctx["content"] ==":plugins":
|
|
plugins = ", ".join([m.__name__ for m in plugin_manager.plugins_loaded])
|
|
bot.send_msg(ctx["channel_id"], f"{plugins}") |