discord-api-docs
discord-api-docs copied to clipboard
X-Audit-Log-Reason header does not work with POST /channels/{channel.id}/messages/bulk-delete
Description
The documentation states that the POST /channels/{channel.id}/messages/bulk-delete
endpoint supports the X-Audit-Log-Reason
https://discord.com/developers/docs/resources/channel#bulk-delete-messages
However, it is clear that when I try this, no reason is actually being attached to the audit log.
This issue was created over a year ago here, however it was closed despite the issue still occurring and reproducible by another user.
I have taken care to ensure trying it from another channel where no bulk deletes have occurred.
Additionally, I have tested it after the cutoff time in which audit logs are merged.
Still, the bug remains.
Steps to Reproduce
POST /channels/{channel.id}/messages/bulk-delete
with a valid array of message ids in the messages
field, and any valid reason given using the X-Audit-Log-Reason
header
https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log
GET /guilds/{guild.id}/audit-logs
with action_type
set to 73 (MESSAGE_BULK_DELETE
) and limit
set to 1 (although I doubt this matters, I'm just showing what exactly I tried) and none of the other fields were set
https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log
Expected Behavior
The GET
request should return an audit log with a reason
field which contains the reason given in the first request with the X-Audit-Log-Reason
header
Current Behavior
The GET
request does not return a reason
field, and no reason is shown in the audit logs in the Discord client either
Screenshots/Videos
Client and System Information
Custom library used when making requests:
https://github.com/quark-bot-discord/gluon
Discord client used to observe whether the reason shows up in the audit logs:
canary 267385 (2f212e6) Host 0.0.420 arm64 macOS 14 (23.1.0)
Was not able to reproduce this locally, am seeing the audit log reason header respected and creating a corresponding audit log entry with the reason.
I think there's something afoot here, re-opening for investigation.
Yeah sorry the way we were reproducing this in a test environment did not exhibit the issue.
~~Another really similar issue that is probably related so will post this here~~
~~When a bot deletes a message no audit log is getting created whatsoever~~
Steps to reproduce:
- create a new channel (to make sure the log does not get merged with a previous one)
- send a message
- delete the message via the rest API with a
X-Audit-Log-Reason
header - get audit logs for the guild/check in client - no log is created
EDIT: Ok, that makes sense, I must have missed that
That's by design because otherwise bots can create an excessive amount of entries.