Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation error in IncomingDiscordSlashInteraction #73

Open
ryuuzake opened this issue Nov 4, 2021 · 0 comments
Open

Validation error in IncomingDiscordSlashInteraction #73

ryuuzake opened this issue Nov 4, 2021 · 0 comments

Comments

@ryuuzake
Copy link

ryuuzake commented Nov 4, 2021

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant