Skip to content

Commit

Permalink
feat(popular-topics): Add webhooks section in threads page (discordjs…
Browse files Browse the repository at this point in the history
  • Loading branch information
Renal-Of-Loon authored Oct 26, 2021
1 parent 1320841 commit ffe0920
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions guide/popular-topics/threads.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,18 @@ const thread = channel.threads.cache.find(x => x.name === 'food-talk');
await thread.members.remove('140214425276776449');
```

## Sending messages to threads with webhooks

It is possible for a webhook built on the parent channel to send messages to the channel's threads. For the purpose of this example, it is assumed a single webhook already exists for that channel. If you wish to learn more about webhooks, see our [webhook guide](/popular-topics/webhooks.md).

```js
const webhooks = await channel.fetchWebhooks();
const webhook = webhooks.first();

await webhook.send({
content: 'Look ma! I\'m in a thread!',
threadId: '123456789012345678',
});
```

And that's it! Now you know all there is to know on working with threads using discord.js!

0 comments on commit ffe0920

Please sign in to comment.