mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +01:00
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 <danialrazafb@gmail.com>
This commit is contained in:
@@ -223,9 +223,13 @@ export class ChannelsAPI {
|
|||||||
public async edit(
|
public async edit(
|
||||||
channelId: Snowflake,
|
channelId: Snowflake,
|
||||||
body: RESTPatchAPIChannelJSONBody,
|
body: RESTPatchAPIChannelJSONBody,
|
||||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
{ signal, reason }: Pick<RequestData, 'reason' | 'signal'> = {},
|
||||||
) {
|
) {
|
||||||
return this.rest.patch(Routes.channel(channelId), { body, signal }) as Promise<RESTPatchAPIChannelResult>;
|
return this.rest.patch(Routes.channel(channelId), {
|
||||||
|
reason,
|
||||||
|
body,
|
||||||
|
signal,
|
||||||
|
}) as Promise<RESTPatchAPIChannelResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -235,8 +239,8 @@ export class ChannelsAPI {
|
|||||||
* @param channelId - The id of the channel to delete
|
* @param channelId - The id of the channel to delete
|
||||||
* @param options - The options for deleting the channel
|
* @param options - The options for deleting the channel
|
||||||
*/
|
*/
|
||||||
public async delete(channelId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
public async delete(channelId: Snowflake, { signal, reason }: Pick<RequestData, 'reason' | 'signal'> = {}) {
|
||||||
return this.rest.delete(Routes.channel(channelId), { signal }) as Promise<RESTDeleteAPIChannelResult>;
|
return this.rest.delete(Routes.channel(channelId), { signal, reason }) as Promise<RESTDeleteAPIChannelResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -441,11 +445,12 @@ export class ChannelsAPI {
|
|||||||
channelId: Snowflake,
|
channelId: Snowflake,
|
||||||
body: RESTPostAPIChannelThreadsJSONBody,
|
body: RESTPostAPIChannelThreadsJSONBody,
|
||||||
messageId?: Snowflake,
|
messageId?: Snowflake,
|
||||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
{ signal, reason }: Pick<RequestData, 'reason' | 'signal'> = {},
|
||||||
) {
|
) {
|
||||||
return this.rest.post(Routes.threads(channelId, messageId), {
|
return this.rest.post(Routes.threads(channelId, messageId), {
|
||||||
body,
|
body,
|
||||||
signal,
|
signal,
|
||||||
|
reason,
|
||||||
}) as Promise<RESTPostAPIChannelThreadsResult>;
|
}) as Promise<RESTPostAPIChannelThreadsResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,7 +465,7 @@ export class ChannelsAPI {
|
|||||||
public async createForumThread(
|
public async createForumThread(
|
||||||
channelId: Snowflake,
|
channelId: Snowflake,
|
||||||
{ message, ...optionsBody }: StartForumThreadOptions,
|
{ message, ...optionsBody }: StartForumThreadOptions,
|
||||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
{ signal, reason }: Pick<RequestData, 'reason' | 'signal'> = {},
|
||||||
) {
|
) {
|
||||||
const { files, ...messageBody } = message;
|
const { files, ...messageBody } = message;
|
||||||
|
|
||||||
@@ -469,7 +474,12 @@ export class ChannelsAPI {
|
|||||||
message: messageBody,
|
message: messageBody,
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.rest.post(Routes.threads(channelId), { files, body, signal }) as Promise<APIThreadChannel>;
|
return this.rest.post(Routes.threads(channelId), {
|
||||||
|
files,
|
||||||
|
body,
|
||||||
|
reason,
|
||||||
|
signal,
|
||||||
|
}) as Promise<APIThreadChannel>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -198,8 +198,8 @@ export class GuildsAPI {
|
|||||||
* @param guildId - The id of the guild to delete
|
* @param guildId - The id of the guild to delete
|
||||||
* @param options - The options for deleting this guild
|
* @param options - The options for deleting this guild
|
||||||
*/
|
*/
|
||||||
public async delete(guildId: Snowflake, { signal, reason }: Pick<RequestData, 'reason' | 'signal'> = {}) {
|
public async delete(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||||
await this.rest.delete(Routes.guild(guildId), { reason, signal });
|
await this.rest.delete(Routes.guild(guildId), { signal });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user