mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Allow empty iterables as a command_prefix
This commit is contained in:
parent
b1fb5ed3d7
commit
caac97c0d1
@ -1081,6 +1081,7 @@ class BotBase(GroupMixin[None]):
|
|||||||
listening for.
|
listening for.
|
||||||
"""
|
"""
|
||||||
prefix = ret = self.command_prefix
|
prefix = ret = self.command_prefix
|
||||||
|
|
||||||
if callable(prefix):
|
if callable(prefix):
|
||||||
# self will be a Bot or AutoShardedBot
|
# self will be a Bot or AutoShardedBot
|
||||||
ret = await discord.utils.maybe_coroutine(prefix, self, message) # type: ignore
|
ret = await discord.utils.maybe_coroutine(prefix, self, message) # type: ignore
|
||||||
@ -1099,9 +1100,6 @@ class BotBase(GroupMixin[None]):
|
|||||||
f"returning either of these, not {ret.__class__.__name__}"
|
f"returning either of these, not {ret.__class__.__name__}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not ret:
|
|
||||||
raise ValueError("Iterable command_prefix must contain at least one prefix")
|
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
@ -1312,8 +1310,7 @@ class Bot(BotBase, discord.Client):
|
|||||||
The command prefix could also be an iterable of strings indicating that
|
The command prefix could also be an iterable of strings indicating that
|
||||||
multiple checks for the prefix should be used and the first one to
|
multiple checks for the prefix should be used and the first one to
|
||||||
match will be the invocation prefix. You can get this prefix via
|
match will be the invocation prefix. You can get this prefix via
|
||||||
:attr:`.Context.prefix`. To avoid confusion empty iterables are not
|
:attr:`.Context.prefix`.
|
||||||
allowed.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user