(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 docs2y ago
method TextChannel#fetchWebhooks() Fetches all webhooks for the method TextChannel#createWebhook() Creates a webhook for the channel.
codelol
codelol2y ago
megatank58
megatank582y ago
check for the type of the channel first?
codelol
codelol2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
codelol
codelol2y ago
oh thanks
monbrey
monbrey2y ago
What's the problem here?
codelol
codelol2y 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
monbrey2y ago
So you need to fetch webhooks
codelol
codelol2y ago
and interaction.channel doesnt have fetchWebhooks or createWebhook
monbrey
monbrey2y 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
codelol2y ago
its GuildTextBasedChannel
monbrey
monbrey2y ago
I think isText() in 13.8 includes channels that can't have webhooks Like DMChannel, Thread channel
codelol
codelol2y ago
oh i see
codelol
codelol2y ago
it shows up now thanks