SGA-A / c2c

Source code for the custom app exclusive to cc, where most interactions begin and end.
MIT License
1 stars 0 forks source link

Unknown Interaction #24

Closed SGA-A closed 8 months ago

SGA-A commented 8 months ago

Describe the bug Fetching the profile of a user that is not registered raises the following error:

Traceback (most recent call last):
  File "C:\Python\Lib\site-packages\discord\client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\host\PycharmProjects\c2c\cogs\slash-events.py", line 22, in get_app_command_error
    await interaction.response.defer(thinking=True) # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\Lib\site-packages\discord\interactions.py", line 661, in defer
    await adapter.create_interaction_response(
  File "C:\Python\Lib\site-packages\discord\webhook\async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

To Reproduce Steps to reproduce the behavior:

  1. Call /profile, input a user that is not registered.
  2. The error occurs, see error.
  3. In the invocation channel, the interaction will fail, and its associated message will be shown.

Expected behavior These are the exact words that should be sent:

Could not find account associated with the user provided.

This does sometimes work and sometimes does not work.

Additional context A few database queries are made when the command is called.

SGA-A commented 8 months ago

Looked into the Tatsu API and found that in some scenarios it takes up to 20 seconds to respond under some user IDs, for bots that have no relationships stored under their accounts. This obviously exceeds the requirement to respond to interactions within 3 seconds.

A clear solution would therefore be to use the Tatsu API to make queries after we check the user inputted is registered. This is being implemented a PR now.