Skip to content

Commit

Permalink
feat(NewsChannel): Support audit log reason on channel follow (abalab…
Browse files Browse the repository at this point in the history
  • Loading branch information
bsian03 authored Oct 4, 2024
1 parent 40656e0 commit 4a0b02f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,7 @@ declare namespace Eris {
executeSlackWebhook(webhookID: string, token: string, options: Record<string, unknown> & { auth?: boolean; threadID?: string; wait: true }): Promise<Message<AnyGuildTextableChannel>>;
executeWebhook(webhookID: string, token: string, options: WebhookPayload & { wait: true }): Promise<Message<AnyGuildTextableChannel>>;
executeWebhook(webhookID: string, token: string, options: WebhookPayload): Promise<void>;
followChannel(channelID: string, webhookChannelID: string): Promise<ChannelFollow>;
followChannel(channelID: string, webhookChannelID: string, reason?: string): Promise<ChannelFollow>;
getActiveGuildThreads(guildID: string): Promise<ListedGuildThreads>;
getArchivedThreads(channelID: string, type: "private", options?: GetArchivedThreadsOptions): Promise<ListedChannelThreads<PrivateThreadChannel>>;
getArchivedThreads(channelID: string, type: "public", options?: GetArchivedThreadsOptions): Promise<ListedChannelThreads<PublicThreadChannel<boolean>>>;
Expand Down Expand Up @@ -3065,7 +3065,7 @@ declare namespace Eris {
type: Constants["ChannelTypes"]["GUILD_NEWS"];
crosspostMessage(messageID: string): Promise<Message<this>>;
edit(options: EditNewsChannelOptions, reason?: string): Promise<this>;
follow(webhookChannelID: string): Promise<ChannelFollow>;
follow(webhookChannelID: string, reason?: string): Promise<ChannelFollow>;
}

export class NewsThreadChannel extends ThreadChannel {
Expand Down
7 changes: 4 additions & 3 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2369,11 +2369,12 @@ class Client extends EventEmitter {
/**
* Follow a NewsChannel in another channel. This creates a webhook in the target channel
* @arg {String} channelID The ID of the NewsChannel
* @arg {String} webhookChannelID The ID of the target channel
* @arg {String} options.webhookChannelID The ID of the target channel
* @arg {String} [reason] The reason to be displayed in audit logs
* @returns {Object} An object containing the NewsChannel's ID and the new webhook's ID
*/
followChannel(channelID, webhookChannelID) {
return this.requestHandler.request("POST", Endpoints.CHANNEL_FOLLOW(channelID), true, { webhook_channel_id: webhookChannelID });
followChannel(channelID, webhookChannelID, reason) {
return this.requestHandler.request("POST", Endpoints.CHANNEL_FOLLOW(channelID), true, { webhook_channel_id: webhookChannelID, reason: reason });
}

/**
Expand Down
5 changes: 3 additions & 2 deletions lib/structures/NewsChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ class NewsChannel extends TextChannel {
/**
* Follow this channel in another channel. This creates a webhook in the target channel
* @arg {String} webhookChannelID The ID of the target channel
* @arg {String} [reason] The reason to be displayed in audit logs
* @returns {Object} An object containing this channel's ID and the new webhook's ID
*/
follow(webhookChannelID) {
return this._client.followChannel.call(this._client, this.id, webhookChannelID);
follow(webhookChannelID, reason) {
return this._client.followChannel.call(this._client, this.id, webhookChannelID, reason);
}
}

Expand Down

0 comments on commit 4a0b02f

Please sign in to comment.