discord / discord-api-docs

Official Discord API Documentation
https://discord.com/developers/docs/intro
Other
5.95k stars 1.26k forks source link

Guild MFA level can be set to True or False #5086

Closed onerandomusername closed 2 years ago

onerandomusername commented 2 years ago

Description

The mfa_level requirement of a guild can be set to true or false, when it should be restricted to 0 or 1. This breaks api clients which expect the level to be 0 or 1, and not a boolean.

Steps to Reproduce

curl -X POST 'https://discord.com/api/v10/guilds/:id/mfa' \
  -H 'authorization: Bot <token>' \
  -H 'content-type: application/json' \
  -d '{"level": true}'

This will set the level to true for that guild, when it should be 1 or 0.

Expected Behavior

API should return {"message": "Invalid MFA Level", "code": 50017}

Current Behavior

The api sets the mfa level to true, which is invalid. Additionally makes the guild object have the mfa level set to true on subsequent requests, which breaks client which expect the level to be 0 or 1.

Screenshots/Videos

No response

Client and System Information

- Python v3.8.12-final
- disnake v2.6.0-alpha
    - disnake pkg_resources: v2.6.0a4254+g8844b24a
- aiohttp v3.8.1
night commented 2 years ago

Thanks for the report. This issue should be fixed.