Suppress exceptions from invoking autocomplete

This commit is contained in:
Rapptz
2023-02-17 13:24:59 -05:00
parent 0c68eb338c
commit 4e09c34bbb
2 changed files with 11 additions and 5 deletions

View File

@ -1235,7 +1235,13 @@ class CommandTree(Generic[ClientT]):
focused = next((opt['name'] for opt in options if opt.get('focused')), None)
if focused is None:
raise AppCommandError('This should not happen, but there is no focused element. This is a Discord bug.')
await command._invoke_autocomplete(interaction, focused, namespace)
try:
await command._invoke_autocomplete(interaction, focused, namespace)
except Exception:
# Suppress exception since it can't be handled anyway.
pass
return
try: