Skip to content

Validation error in IncomingDiscordSlashInteraction  #73

Description

@ryuuzake

I found a validation error when the slash command was sent using DM.

Below are the validation error, handler, and discord requests.

Validation Error

2021-11-04T07:05:55.953681+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/dispike/server.py", line 146, in handle_interactions
2021-11-04T07:05:55.953681+00:00 app[web.1]:     _parse_to_object = IncomingDiscordSlashInteraction(**_get_request_body)
2021-11-04T07:05:55.953681+00:00 app[web.1]:   File "pydantic/main.py", line 406, in pydantic.main.BaseModel.__init__
2021-11-04T07:05:55.953681+00:00 app[web.1]: pydantic.error_wrappers.ValidationError: 2 validation errors for IncomingDiscordSlashInteraction
2021-11-04T07:05:55.953682+00:00 app[web.1]: guild_id
2021-11-04T07:05:55.953682+00:00 app[web.1]:   field required (type=value_error.missing)
2021-11-04T07:05:55.953682+00:00 app[web.1]: member
2021-11-04T07:05:55.953682+00:00 app[web.1]:   field required (type=value_error.missing)

Handler

@bot.on("verb")
async def handle_verb_request(ctx: IncomingDiscordSlashInteraction) -> DiscordResponse:

Discord Request

{
  "application_id": "<cleaned>",
  "channel_id": "<cleaned>",
  "data": {
    "id": "<cleaned>",
    "name": "verb",
    "type": 1
  },
  "id": "<cleaned>",
  "token": "<cleaned>",
  "type": 2,
  "user": {
    "avatar": "<cleaned>",
    "discriminator": "<cleaned>",
    "id": "<cleaned>",
    "public_flags": 0,
    "username": "<cleaned>"
  },
  "version": 1
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions