discord-net / Discord.Net

An unofficial .Net wrapper for the Discord API (https://discord.com/)
https://discordnet.dev
MIT License
3.32k stars 737 forks source link

[Bug]: Remove the `reason` field from `AddBanAsync` and `KickAsync` methods or make them obsolete #2538

Closed 1NieR closed 1 year ago

1NieR commented 1 year ago

Check The Docs

Verify Issue Source

Check your intents

Description

Since API v10 the reason field has been removed and replaced by X-Audit-Log-Reason. https://github.com/discord/discord-api-docs/pull/5219#issue-1312161437 API V10 ban kick

Version

3.8.1

Working Version

No response

Logs

(none)

Sample

No response

Packages

N/A

SylveonDeko commented 1 year ago

How about instead we fix the field and not break many many bots

cjbonn commented 1 year ago

Just noting the locations in case someone wants to PR. I might get around to this myself eventually. Should be easy enough to change the reason logic to add the X-Audit-Log-Reason to the options parameter in both these methods (options.AuditLogReason = reason; perhaps?).

Possibly need to think of how to handle if both the reason param and RequestOptions.AuditLogReason are both supplied at the same time.

Ban: https://github.com/discord-net/Discord.Net/blob/25cfb8822fe63adfff4cb493326ad8915e634dbc/src/Discord.Net.Rest/DiscordRestApiClient.cs#L1648 Kick: https://github.com/discord-net/Discord.Net/blob/25cfb8822fe63adfff4cb493326ad8915e634dbc/src/Discord.Net.Rest/DiscordRestApiClient.cs#L1854