S64
S64
DIAdiscord.js - Imagine an app
Created by S64 on 9/25/2023 in #djs-questions
How to receive webhook update gateway events?
Hello, I'm trying to receive webhook events through the code below:
import { Client, Events, GatewayIntentBits } from 'discord.js'

const client = new Client({
intents: [GatewayIntentBits.GuildWebhooks],
})

client.once(Events.ClientReady, (c) => {
console.log('Ready as ', c.user?.tag)
})

client.on(Events.WebhooksUpdate, (c) => {
console.log('webhook update', c)
})

client.login(process.env.BOT_TOKEN)
import { Client, Events, GatewayIntentBits } from 'discord.js'

const client = new Client({
intents: [GatewayIntentBits.GuildWebhooks],
})

client.once(Events.ClientReady, (c) => {
console.log('Ready as ', c.user?.tag)
})

client.on(Events.WebhooksUpdate, (c) => {
console.log('webhook update', c)
})

client.login(process.env.BOT_TOKEN)
I tried - changing a webhook's name - adding/moving a webhook but the only log I get is the initial ready log. The bot has Administrator permission. Is there something wrong with the code snippet above? Version's 14.13.0
7 replies