1
0
mirror of https://gitlab.com/ddorn/tfjm-discord-bot.git synced 2025-07-08 07:30:20 +02:00

CustomBot with full reload

This commit is contained in:
ddorn
2020-04-30 17:26:33 +02:00
parent 3bfad6e0a9
commit 3b9f4aae95
9 changed files with 149 additions and 34 deletions

View File

@ -1,4 +1,6 @@
import code
import sys
from importlib import reload
from pprint import pprint
import discord
@ -8,13 +10,20 @@ from discord.ext.commands import Cog
from discord.utils import get
from src.constants import *
from src.core import CustomBot
COGS_SHORTCUTS = {"d": "dev", "ts": "teams", "t": "tirages", "m": "misc", "e": "errors"}
COGS_SHORTCUTS = {
"d": "tirages",
"e": "errors",
"m": "misc",
"t": "teams",
"u": "src.utils",
"v": "dev",
}
class DevCog(Cog, name="Dev tools"):
def __init__(self, bot: Bot):
def __init__(self, bot: CustomBot):
self.bot = bot
@command(name="interrupt")
@ -69,6 +78,11 @@ class DevCog(Cog, name="Dev tools"):
possibles: `teams`, `tirages`, `dev`.
"""
if name is None:
self.bot.reload()
await ctx.send(":tada: The bot was reloaded !")
return
names = [name] if name else list(COGS_SHORTCUTS.values())
for name in names: