diff --git a/redbot/core/bot.py b/redbot/core/bot.py index 7bf564f7c..f9173e519 100644 --- a/redbot/core/bot.py +++ b/redbot/core/bot.py @@ -6,14 +6,14 @@ from importlib.machinery import ModuleSpec from pathlib import Path import discord -from discord.ext import commands +from discord.ext.commands.bot import BotBase from discord.ext.commands import GroupMixin from .cog_manager import CogManager from . import Config, i18n, RedContext -class Red(commands.Bot): +class RedBase(BotBase): def __init__(self, cli_flags, bot_dir: Path=Path.cwd(), **kwargs): self._shutdown_mode = ExitCodes.CRITICAL self.db = Config.get_core_conf(force_registration=True) @@ -86,18 +86,6 @@ class Red(commands.Bot): async def get_context(self, message, *, cls=RedContext): return await super().get_context(message, cls=cls) - async def shutdown(self, *, restart=False): - """Gracefully quits Red with exit code 0 - - If restart is True, the exit code will be 26 instead - Upon receiving that exit code, the launcher restarts Red""" - if not restart: - self._shutdown_mode = ExitCodes.SHUTDOWN - else: - self._shutdown_mode = ExitCodes.RESTART - - await self.logout() - def list_packages(self): """Lists packages present in the cogs the folder""" return os.listdir("cogs") @@ -176,7 +164,24 @@ class Red(commands.Bot): # del sys.modules[name] +class Red(RedBase, discord.AutoShardedClient): + """ + You're welcome Caleb. + """ + async def shutdown(self, *, restart=False): + """Gracefully quits Red with exit code 0 + + If restart is True, the exit code will be 26 instead + Upon receiving that exit code, the launcher restarts Red""" + if not restart: + self._shutdown_mode = ExitCodes.SHUTDOWN + else: + self._shutdown_mode = ExitCodes.RESTART + + await self.logout() + + class ExitCodes(Enum): CRITICAL = 1 SHUTDOWN = 0 - RESTART = 26 \ No newline at end of file + RESTART = 26