Skip to content

Commit

Permalink
feat(Webhook): add support for thread_id in Webhook send
Browse files Browse the repository at this point in the history
  • Loading branch information
ckohen committed May 12, 2021
1 parent 1c77a6c commit d570121
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/structures/Webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class Webhook {
* @property {string|boolean} [code] Language for optional codeblock formatting to apply
* @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if
* it exceeds the character limit. If an object is provided, these are the options for splitting the message.
* @property {Snowflake} [threadID] The id of the thread in the channel to send to.
* <info>For interaction webhooks, this property is ignored</info>
*/

/**
Expand All @@ -123,6 +125,11 @@ class Webhook {
* .then(message => console.log(`Sent message: ${message.content}`))
* .catch(console.error);
* @example
* // Send a basic message in a thread
* webhook.send('hello!', { threadID: '836856309672348295' })
* .then(message => console.log(`Sent message: ${message.content}`))
* .catch(console.error);
* @example
* // Send a remote file
* webhook.send({
* files: ['https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048']
Expand Down Expand Up @@ -173,7 +180,7 @@ class Webhook {
.post({
data,
files,
query: { wait: true },
query: { thread_id: apiMessage.options.threadID, wait: true },
auth: false,
})
.then(d => {
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3817,6 +3817,7 @@ declare module 'discord.js' {
username?: string;
avatarURL?: string;
embeds?: (MessageEmbed | object)[];
threadID?: Snowflake;
}

type WebhookTypes = 'Incoming' | 'Channel Follower';
Expand Down

0 comments on commit d570121

Please sign in to comment.