mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
parent
4d7f065b10
commit
684004d614
@ -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,6 +164,23 @@ 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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user