mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
CR fix: add isinstance check
This commit is contained in:
parent
4aac637251
commit
e8b09d3fcf
1 changed files with 8 additions and 2 deletions
|
|
@ -68,8 +68,14 @@ class Command(Filter):
|
|||
"""
|
||||
if isinstance(commands, (str, BotCommand)):
|
||||
commands = (commands,)
|
||||
if isinstance(commands, Iterable):
|
||||
commands = [cmd.command if isinstance(cmd, BotCommand) else cmd for cmd in commands]
|
||||
elif isinstance(commands, Iterable):
|
||||
pass
|
||||
else:
|
||||
raise ValueError(
|
||||
"Command filter doesn't support {} as input. "
|
||||
"It only supports str, BotCommand object or their Iterable"
|
||||
)
|
||||
commands = [cmd.command if isinstance(cmd, BotCommand) else cmd for cmd in commands]
|
||||
|
||||
self.commands = list(map(str.lower, commands)) if ignore_case else commands
|
||||
self.prefixes = prefixes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue