discord-php / DiscordPHP

An API to interact with the popular messaging app Discord
MIT License
985 stars 236 forks source link

Fix CommandPermissions fetch #1055

Closed xWildFire closed 1 year ago

xWildFire commented 1 year ago

:command_id and :application_id not defined

CommandString commented 1 year ago

Could I ask why this is a bug? Additionally, could you provide the code that you're using in combination with this bug fix.

xWildFire commented 1 year ago

Could I ask why this is a bug? Additionally, could you provide the code that you're using in combination with this bug fix.

$interaction->guild->command_permissions->fetch($commandId);

without fix(missing application_id and command_id):

[04.02.2023, 15:35:09] [WARNING] REQ GET applications/:application_id/guilds/484723871887392772/commands/:command_id/permissions failed: Discord\Http\Exceptions\RequestFailedException: Bad Request - {
    "code": 50035,
    "errors": {
        "application_id": {
            "_errors": [
                {
                    "code": "NUMBER_TYPE_COERCE",
                    "message": "Value \":application_id\" is not snowflake."
                }
            ]
        },
        "command_id": {
            "_errors": [
                {
                    "code": "NUMBER_TYPE_COERCE",
                    "message": "Value \":command_id\" is not snowflake."
                }
            ]
        }
    },
    "message": "Invalid Form Body"
}