Skip to content

Commit b0b8423

Browse files
fix: command options and choices doesn't syncs (#1046)
* fix: command options doesn't syncs * ci: correct from checks. * Update interactions/client/bot.py Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent fcb498d commit b0b8423

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

interactions/client/bot.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def __check_options(command, data):
201201
if any(option not in _command_option_names for option in _data_option_names) or len(
202202
_data_option_names
203203
) != len(_command_option_names):
204-
return False, command
204+
return False
205205

206206
for option in command.get("options"):
207207
for _option in data.get("options"):
@@ -213,7 +213,7 @@ def __check_options(command, data):
213213
or not option.get(option_attr)
214214
and _option.get(option_attr)
215215
):
216-
return False, command
216+
return False
217217
elif option_attr == "choices":
218218
if not option.get("choices") or not _option.get("choices"):
219219
continue
@@ -228,7 +228,7 @@ def __check_options(command, data):
228228
if any(
229229
_ not in _option_choice_names for _ in _data_choice_names
230230
) or len(_data_choice_names) != len(_option_choice_names):
231-
return False, command
231+
return False
232232

233233
for choice in option.get("choices"):
234234
for _choice in _option.get("choices"):
@@ -240,17 +240,17 @@ def __check_options(command, data):
240240
or not choice.get(choice_attr)
241241
and _choice.get(choice_attr)
242242
):
243-
return False, command
243+
return False
244244
elif choice.get(choice_attr) != _choice.get(
245245
choice_attr
246246
):
247-
return False, command
247+
return False
248248
else:
249249
continue
250250

251251
for i, __name in enumerate(_option_choice_names):
252252
if _data_choice_names[i] != __name:
253-
return False, command
253+
return False
254254

255255
elif option_attr == "required":
256256
if (
@@ -263,22 +263,21 @@ def __check_options(command, data):
263263
elif option_attr == "options":
264264
if not option.get(option_attr) and not _option.get("options"):
265265
continue
266-
_clean, _command = __check_options(option, _option)
266+
_clean = __check_options(option, _option)
267267
if not _clean:
268-
return _clean, _command
268+
return _clean
269269

270270
elif option.get(option_attr) != _option.get(option_attr):
271-
return False, command
271+
return False
272272
else:
273273
continue
274-
275274
return next(
276275
(
277-
(False, command)
276+
False
278277
for i, __name in enumerate(_command_option_names)
279278
if _data_option_names[i] != __name
280279
),
281-
(True, command),
280+
True,
282281
)
283282

284283
for command in pool:
@@ -308,7 +307,7 @@ def __check_options(command, data):
308307

309308
elif command.get("options") and data.get("options"):
310309

311-
clean, _command = __check_options(command, data)
310+
clean = __check_options(command, data)
312311

313312
if not clean:
314313
return clean, _command

0 commit comments

Comments
 (0)