Skip to content

Commit a027b74

Browse files
authored
fix!: prevent exception for non-chat-input commands when no description is present (#544)
* fix!: prevent exception being raised for non-chat-input commands when no description is present * fix!: prevent exception being raised for non-chat-input commands when no description is present
1 parent 2811842 commit a027b74

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

interactions/client.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -471,24 +471,19 @@ def __check_coro():
471471

472472
else:
473473
log.debug(f"checking command '{command.name}':")
474-
475474
if (
476475
not re.fullmatch(reg, command.name)
477476
and command.type == ApplicationCommandType.CHAT_INPUT
478477
):
479478
raise InteractionException(
480479
11, message=f"Your command does not match the regex for valid names ('{regex}')"
481480
)
482-
elif (
483-
command.type == ApplicationCommandType.CHAT_INPUT
484-
and command.description is MISSING
485-
or not command.description
481+
elif command.type == ApplicationCommandType.CHAT_INPUT and (
482+
command.description is MISSING or not command.description
486483
):
487484
raise InteractionException(11, message="A description is required.")
488-
elif (
489-
command.type != ApplicationCommandType.CHAT_INPUT
490-
and command.description is not MISSING
491-
and command.description
485+
elif command.type != ApplicationCommandType.CHAT_INPUT and (
486+
command.description is not MISSING and command.description
492487
):
493488
raise InteractionException(
494489
11, message="Only chat-input commands can have a description."

0 commit comments

Comments
 (0)