timotejroiko / discord.js-light

All the power of discord.js, zero caching. This library modifies discord.js's internal classes and functions in order to give you full control over its caching behaviour.
Apache License 2.0
292 stars 29 forks source link

How to send webhook in the thread? #86

Closed zeteticl closed 2 years ago

zeteticl commented 2 years ago

const channel = await client.channels.fetch(discord.channelId); let webhooks = await channel.fetchWebhooks(); webhook = webhooks.find(v => { return v.name == 'XOXO' && v.type == "Incoming"; }) await webhook.send({ content: text, username: message.myName.username, avatarURL: message.myName.avatarURL });

It is work in channel, but get error in thread

error TypeError: channel.fetchWebhooks is not a function

timotejroiko commented 2 years ago

According to the discord.js documentation, there is no fetchWebhooks method on ThreadChannels.

Im not sure if there is a reason for it not existing, you can try asking the discord.js developers.

In the meanwhile you can try using guild.fetchWebhooks() and see if you find the webhooks you're looking for in there.

zeteticl commented 2 years ago

Thankyou so much. Finally i done my work