From ad89e38b783b37ccd03e0fec6a9e8602538fafd8 Mon Sep 17 00:00:00 2001 From: CoasterFreakDE Date: Mon, 19 Dec 2022 13:31:01 +0100 Subject: [PATCH] Optional removal of command system Signed-off-by: CoasterFreakDE --- discord/ext/commands/bot.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 713e7fa9..11ad5dbd 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -109,7 +109,7 @@ def __repr__(self): class BotBase(GroupMixin): - def __init__(self, command_prefix, help_command=_default, description=None, **options): + def __init__(self, command_prefix=None, help_command=_default, description=None, **options): super().__init__(**options) self.command_prefix = command_prefix self.extra_events = {} @@ -1122,6 +1122,9 @@ async def get_prefix(self, message): listening for. """ prefix = ret = self.command_prefix + if prefix is None: + return None + if callable(prefix): ret = await discord.utils.maybe_coroutine(prefix, self, message) @@ -1181,6 +1184,9 @@ class be provided, it must be similar enough to :class:`.Context`\'s return ctx prefix = await self.get_prefix(message) + if prefix is None: + return ctx + invoked_prefix = prefix if isinstance(prefix, str): @@ -1274,6 +1280,8 @@ async def process_commands(self, message): return ctx = await self.get_context(message) + if ctx.command is None: + return await self.invoke(ctx) async def on_message(self, message):