discord-api-docs
discord-api-docs copied to clipboard
Permissions in audit log gateway event are serialized as numbers instead of strings
Description
The docs state the following about permissions:
Permissions are stored in a variable-length integer serialized into a string, and are calculated using bitwise operations. [...] In API v8 and above, all permissions are serialized as strings, including the allow and deny fields in overwrites. [...] In API v6 (now deprecated), the permissions, allow, and deny fields in roles and overwrites are still serialized as a number
However, when receiving GUILD_AUDIT_LOG_ENTRY_CREATE
events, these fields do come as integers.
This didn't seem to be the case before (I'm only noticing these errors on my bot now, at least), but I haven't tested enough to see if it's an audit log only thing.
Steps to Reproduce
- Change a role's permissions for a channel
- Receive a payload like this:
{"t":"GUILD_AUDIT_LOG_ENTRY_CREATE","s":17,"op":0,"d":{"user_id":"","target_id":"","options":{"type":"0","role_name":"","id":""},"id":"","changes":[{"new_value":"","key":"id"},{"new_value":0,"key":"type"},{"new_value":1024,"key":"allow"},{"new_value":0,"key":"deny"}],"action_type":13,"guild_id":""}}
(redacted IDs and role name)
Expected Behavior
Permissions should come serialized as strings.
Current Behavior
Permissions come serialized as numbers.
Screenshots/Videos
No response
Client and System Information
Kord Linux 64-bit
https://github.com/discord/discord-api-docs/issues/6493 related (most likely) issue
Missed that, interesting bug :) Thanks!