66from .slash .tools import ParseMethod , cache_data , format_name , handle_options , handle_thing
77from .slash .http import create_global_command , create_guild_command , delete_global_command , delete_guild_command , delete_guild_commands , edit_global_command , edit_guild_command , get_command , get_command_permissions , get_global_commands , get_guild_commands , delete_global_commands , get_id , update_command_permissions
88from .slash .types import AdditionalType , CommandType , ContextCommand , MessageCommand , OptionType , SlashCommand , SlashOption , SlashSubcommand , UserCommand
9- from .tools import MISSING , _none , _or , get_index , setup_logger
9+ from .tools import MISSING , _none , _or , get_index , setup_logger , get
1010from .http import jsonifyMessage , BetterRoute , send_files
1111from .receive import ComponentContext , Interaction , Message , PressedButton , SelectedMenu , SlashedContext , WebhookMessage , SlashedCommand , SlashedSubCommand , getMessage
1212from .override import override_dpy as override_it
@@ -124,7 +124,7 @@ def add_cog_override(*args, **kwargs):
124124 self ._add_to_cache (com )
125125 old_add (* args , ** kwargs )
126126 if self .ready is True and sync_on_cog is True :
127- self ._discord .loop .create_task (self .sync_commands (self .delete_unused ))
127+ self ._discord .loop .run_until_complete (self .sync_commands (self .delete_unused ))
128128 self ._discord .add_cog = add_cog_override
129129
130130 old_remove = self ._discord .remove_cog
@@ -135,7 +135,7 @@ def remove_cog_override(*args, **kwargs):
135135 self ._remove_from_cache (com )
136136 old_remove (* args , ** kwargs )
137137 if self .ready is True and sync_on_cog is True :
138- self ._discord .loop .create_task (self .sync_commands (self .delete_unused ))
138+ self ._discord .loop .run_until_complete (self .sync_commands (self .delete_unused ))
139139 self ._discord .remove_cog = remove_cog_override
140140
141141 async def on_connect ():
@@ -397,7 +397,7 @@ async def _get_guild_commands(self, guild_id: str) -> List[dict]:
397397 logging .debug ("getting guild commands in " + str (guild_id ))
398398 return await get_guild_commands (self ._discord , guild_id )
399399
400- def gather_commands (self ):
400+ def gather_commands (self ) -> Dict [ str , SlashCommand ] :
401401 commands = self .commands .copy ()
402402 for _base in self .subcommands :
403403 # get first base
@@ -644,7 +644,7 @@ async def edit_command(self, old_name, typ: Literal["slash", 1, "user", 2, "mess
644644 else :
645645 await self .create_command (command )
646646 self ._set_command (old_name , command )
647-
647+
648648 def _get_command (self , name , typ : Literal ["slash" , 1 , "user" , 2 , "message" , 3 ]) -> SlashCommand :
649649 typ = CommandType .from_string (typ )
650650 if typ == CommandType .SLASH :
0 commit comments