From 9fc3e5ea72a2714d81cc57cbac4f378a49934446 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Fri, 11 Jul 2025 10:00:58 +0100 Subject: [PATCH] fix: Adjust `reason` in methods options (#10977) fix: Adjust `reason` in methods options (#10976) * fix(channel): allow reason in editing * fix(channel): allow reason in `delete()` * fix(channel): allow reason in creating threads * chore: run format * fix(guild): remove incorrect `reason` option --------- Co-authored-by: Danial Raza --- packages/core/src/api/channel.ts | 24 +++++++++++++++++------- packages/core/src/api/guild.ts | 4 ++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/packages/core/src/api/channel.ts b/packages/core/src/api/channel.ts index fe8aa20c6..e1cbd456e 100644 --- a/packages/core/src/api/channel.ts +++ b/packages/core/src/api/channel.ts @@ -223,9 +223,13 @@ export class ChannelsAPI { public async edit( channelId: Snowflake, body: RESTPatchAPIChannelJSONBody, - { signal }: Pick = {}, + { signal, reason }: Pick = {}, ) { - return this.rest.patch(Routes.channel(channelId), { body, signal }) as Promise; + return this.rest.patch(Routes.channel(channelId), { + reason, + body, + signal, + }) as Promise; } /** @@ -235,8 +239,8 @@ export class ChannelsAPI { * @param channelId - The id of the channel to delete * @param options - The options for deleting the channel */ - public async delete(channelId: Snowflake, { signal }: Pick = {}) { - return this.rest.delete(Routes.channel(channelId), { signal }) as Promise; + public async delete(channelId: Snowflake, { signal, reason }: Pick = {}) { + return this.rest.delete(Routes.channel(channelId), { signal, reason }) as Promise; } /** @@ -441,11 +445,12 @@ export class ChannelsAPI { channelId: Snowflake, body: RESTPostAPIChannelThreadsJSONBody, messageId?: Snowflake, - { signal }: Pick = {}, + { signal, reason }: Pick = {}, ) { return this.rest.post(Routes.threads(channelId, messageId), { body, signal, + reason, }) as Promise; } @@ -460,7 +465,7 @@ export class ChannelsAPI { public async createForumThread( channelId: Snowflake, { message, ...optionsBody }: StartForumThreadOptions, - { signal }: Pick = {}, + { signal, reason }: Pick = {}, ) { const { files, ...messageBody } = message; @@ -469,7 +474,12 @@ export class ChannelsAPI { message: messageBody, }; - return this.rest.post(Routes.threads(channelId), { files, body, signal }) as Promise; + return this.rest.post(Routes.threads(channelId), { + files, + body, + reason, + signal, + }) as Promise; } /** diff --git a/packages/core/src/api/guild.ts b/packages/core/src/api/guild.ts index b8bbd8530..ec41c3b20 100644 --- a/packages/core/src/api/guild.ts +++ b/packages/core/src/api/guild.ts @@ -198,8 +198,8 @@ export class GuildsAPI { * @param guildId - The id of the guild to delete * @param options - The options for deleting this guild */ - public async delete(guildId: Snowflake, { signal, reason }: Pick = {}) { - await this.rest.delete(Routes.guild(guildId), { reason, signal }); + public async delete(guildId: Snowflake, { signal }: Pick = {}) { + await this.rest.delete(Routes.guild(guildId), { signal }); } /**