discord / discord-api-docs

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

X-Audit-Log-Reason header does not work with POST /channels/{channel.id}/messages/bulk-delete #6673

Open Starman3787 opened 7 months ago

Starman3787 commented 7 months ago

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

image image

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)

jkcailteux commented 6 months ago

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.

jhgg commented 6 months ago

I think there's something afoot here, re-opening for investigation.

jhgg commented 6 months ago

Yeah sorry the way we were reproducing this in a test environment did not exhibit the issue.

Misha-133 commented 6 months ago

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:

EDIT: Ok, that makes sense, I must have missed that

Rapptz commented 6 months ago

That's by design because otherwise bots can create an excessive amount of entries.