(Solved) Access channel webhooks from interaction?

I'm creating a slash command with discord.js and I need to be able to fetch/create webhooks. I already tried CommandInteraction.channel.webhooks but nothing shows up when I type it in
15 Replies
d.js docs
d.js docs3y ago
method TextChannel#fetchWebhooks() Fetches all webhooks for the method TextChannel#createWebhook() Creates a webhook for the channel.
codelol
codelolOP3y ago
megatank58
megatank583y ago
check for the type of the channel first?
codelol
codelolOP3y ago
Baltraz
Baltraz3y ago
btw u dont need to import client u can access via <Interaction>.client
codelol
codelolOP3y ago
oh thanks
monbrey
monbrey3y ago
What's the problem here?
codelol
codelolOP3y ago
I'm creating a slash command with discord.js and I need to be able to fetch/create webhooks. I already tried CommandInteraction.channel.webhooks but nothing shows up when I type it in yeah i did
monbrey
monbrey3y ago
So you need to fetch webhooks
codelol
codelolOP3y ago
and interaction.channel doesnt have fetchWebhooks or createWebhook
monbrey
monbrey3y ago
It does if you check that it's a GUILD_TEXT channel You need to know how to typeguard if you're going to use TypeScript
codelol
codelolOP3y ago
its GuildTextBasedChannel
monbrey
monbrey3y ago
I think isText() in 13.8 includes channels that can't have webhooks Like DMChannel, Thread channel
codelol
codelolOP3y ago
oh i see
codelol
codelolOP3y ago
it shows up now thanks
Want results from more Discord servers?
Add your server