@@ -142,7 +142,7 @@ class InteractionBotBase(CommonBotBase):
142
142
def __init__ (
143
143
self ,
144
144
* ,
145
- command_sync : ApplicationCommandSyncFlags = None ,
145
+ command_sync : Optional [ ApplicationCommandSyncFlags ] = None ,
146
146
test_guilds : Optional [Sequence [int ]] = None ,
147
147
** options : Any ,
148
148
):
@@ -178,9 +178,7 @@ def __init__(
178
178
self ._schedule_app_command_preparation ()
179
179
180
180
def application_commands_iterator (self ) -> Iterable [InvokableApplicationCommand ]:
181
- return chain (
182
- self ._all_app_commands .values (),
183
- )
181
+ yield from self ._all_app_commands .values ()
184
182
185
183
@property
186
184
def all_app_commands (self ) -> List [InvokableApplicationCommand ]:
@@ -371,7 +369,7 @@ def add_message_command(self, message_command: InvokableMessageCommand) -> None:
371
369
] = message_command
372
370
373
371
def remove_slash_command (
374
- self , name : str , * , guild_id : int = None
372
+ self , name : str , * , guild_id : Optional [ int ] = None
375
373
) -> Optional [InvokableSlashCommand ]:
376
374
"""Removes an :class:`InvokableSlashCommand` from the internal list
377
375
of slash commands.
@@ -400,7 +398,7 @@ def remove_slash_command(
400
398
return command
401
399
402
400
def remove_user_command (
403
- self , name : str , * , guild_id : int = None
401
+ self , name : str , * , guild_id : Optional [ int ] = None
404
402
) -> Optional [InvokableUserCommand ]:
405
403
"""Removes an :class:`InvokableUserCommand` from the internal list
406
404
of user commands.
@@ -422,7 +420,7 @@ def remove_user_command(
422
420
return command
423
421
424
422
def remove_message_command (
425
- self , name : str , * , guild_id : int = None
423
+ self , name : str , * , guild_id : Optional [ int ] = None
426
424
) -> Optional [InvokableMessageCommand ]:
427
425
"""Removes an :class:`InvokableMessageCommand` from the internal list
428
426
of message commands.
@@ -445,24 +443,36 @@ def remove_message_command(
445
443
446
444
@overload
447
445
def get_app_command (
448
- self , name : str , type : Literal [ApplicationCommandType .chat_input ], * , guild_id : int = None
446
+ self ,
447
+ name : str ,
448
+ type : Literal [ApplicationCommandType .chat_input ],
449
+ * ,
450
+ guild_id : Optional [int ] = None ,
449
451
) -> Optional [InvokableSlashCommand ]:
450
452
...
451
453
452
454
@overload
453
455
def get_app_command (
454
- self , name : str , type : Literal [ApplicationCommandType .message ], * , guild_id : int = None
456
+ self ,
457
+ name : str ,
458
+ type : Literal [ApplicationCommandType .message ],
459
+ * ,
460
+ guild_id : Optional [int ] = None ,
455
461
) -> Optional [InvokableMessageCommand ]:
456
462
...
457
463
458
464
@overload
459
465
def get_app_command (
460
- self , name : str , type : Literal [ApplicationCommandType .user ], * , guild_id : int = None
466
+ self ,
467
+ name : str ,
468
+ type : Literal [ApplicationCommandType .user ],
469
+ * ,
470
+ guild_id : Optional [int ] = None ,
461
471
) -> Optional [InvokableUserCommand ]:
462
472
...
463
473
464
474
def get_app_command (
465
- self , name : str , type : ApplicationCommandType , * , guild_id : int = None
475
+ self , name : str , type : ApplicationCommandType , * , guild_id : Optional [ int ] = None
466
476
) -> Optional [InvokableApplicationCommand ]:
467
477
# this does not get commands by ID, use (some other method) to do that
468
478
if not isinstance (name , str ):
@@ -473,7 +483,7 @@ def get_app_command(
473
483
return command
474
484
475
485
def get_slash_command (
476
- self , name : str , * , guild_id : int = None
486
+ self , name : str , * , guild_id : Optional [ int ] = None
477
487
) -> Optional [Union [InvokableSlashCommand , SubCommandGroup , SubCommand ]]:
478
488
"""Works like ``Bot.get_command``, but for slash commands.
479
489
@@ -515,7 +525,7 @@ def get_slash_command(
515
525
return group .children .get (chain [2 ])
516
526
517
527
def get_user_command (
518
- self , name : str , * , guild_id : int = None
528
+ self , name : str , * , guild_id : Optional [ int ] = None
519
529
) -> Optional [InvokableUserCommand ]:
520
530
"""Gets an :class:`InvokableUserCommand` from the internal list
521
531
of user commands.
@@ -533,7 +543,7 @@ def get_user_command(
533
543
return self .get_app_command (name , ApplicationCommandType .user , guild_id = guild_id )
534
544
535
545
def get_message_command (
536
- self , name : str , * , guild_id : int = None
546
+ self , name : str , * , guild_id : Optional [ int ] = None
537
547
) -> Optional [InvokableMessageCommand ]:
538
548
"""Gets an :class:`InvokableMessageCommand` from the internal list
539
549
of message commands.
0 commit comments