@@ -214,15 +214,12 @@ async def sync_commands(self) -> None:
214
214
215
215
async def register_commands (self ) -> None :
216
216
"""|coro|
217
-
218
217
Registers all commands that have been added through :meth:`.add_application_command`.
219
218
This method cleans up all commands over the API and should sync them with the internal cache of commands.
220
219
This will only be rolled out to Discord if :meth:`.http.get_global_commands` has certain keys that differ from :data:`.pending_application_commands`
221
-
222
220
By default, this coroutine is called inside the :func:`.on_connect`
223
221
event. If you choose to override the :func:`.on_connect` event, then
224
222
you should invoke this coroutine as well.
225
-
226
223
.. versionadded:: 2.0
227
224
"""
228
225
commands_to_bulk = []
@@ -253,7 +250,7 @@ async def register_commands(self) -> None:
253
250
if match :
254
251
as_dict ["id" ] = match ["id" ]
255
252
256
- keys_to_check = {"default_permission" : True , "name" : True , "description" : True , "options" : ["type" , "name" , "description" ]}
253
+ keys_to_check = {"default_permission" : True , "name" : True , "description" : True , "options" : ["type" , "name" , "description" , "autocomplete" , "choices" ]}
257
254
for key , more_keys in {
258
255
key :more_keys
259
256
for key , more_keys in keys_to_check .items ()
@@ -262,14 +259,23 @@ async def register_commands(self) -> None:
262
259
}.items ():
263
260
if key == "options" :
264
261
for i , option_dict in enumerate (as_dict [key ]):
265
- for key2_change in [
266
- key2
267
- for key2 in more_keys
268
- if key2 in option_dict .keys () and key2 in match [key ][i ].keys ()
269
- if option_dict [key2 ] != match [key ][i ][key2 ]
270
- ]:
271
- # When a property in the options of a pending global command is changed
272
- needs_bulk = True
262
+ if command .name == "recent" :
263
+ print (option_dict , "|||||" , match [key ][i ])
264
+ for key2 in more_keys :
265
+ pendingVal = None
266
+ if key2 in option_dict .keys ():
267
+ pendingVal = option_dict [key2 ]
268
+ if pendingVal == False or pendingVal == []: # Registered commands are not available if choices is an empty array or if autocomplete is false
269
+ pendingVal = None
270
+ matchVal = None
271
+ if key2 in match [key ][i ].keys ():
272
+ matchVal = match [key ][i ][key2 ]
273
+ if matchVal == False or matchVal == []: # Registered commands are not available if choices is an empty array or if autocomplete is false
274
+ matchVal = None
275
+
276
+ if pendingVal != matchVal :
277
+ # When a property in the options of a pending global command is changed
278
+ needs_bulk = True
273
279
else :
274
280
if as_dict [key ] != match [key ]:
275
281
# When a property in a pending global command is changed
0 commit comments