channel.createWebhook is not working right

channel.createWebhook({
name: "TEst"
}).then((hook) => {
console.log("hi")
})
channel.createWebhook({
name: "TEst"
}).then((hook) => {
console.log("hi")
})
there is no hi in the console
2 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
RichtigJoJo
RichtigJoJo2y ago
But the Bot creates a webhook no errors I tried .catch
const Discord = require("discord.js")
const client = require("../index.js").client

client.on("guildBanAdd", async (ban) => {
let webhook = `https://discord.com/api/webhooks/${webhookUrl}`
if(!await Promise.allSettled(await channel.fetchWebhooks()).then((res) => res.find((e) => e.value[0] == webhookUrl.split("/")[0]))) channel.createWebhook({
name: "Test",
avatar: ban.client.user.displayAvatarURL()
}).then((hook) => {console.log(hook)
webhook = hook.url
}).catch(console.error)
})
const Discord = require("discord.js")
const client = require("../index.js").client

client.on("guildBanAdd", async (ban) => {
let webhook = `https://discord.com/api/webhooks/${webhookUrl}`
if(!await Promise.allSettled(await channel.fetchWebhooks()).then((res) => res.find((e) => e.value[0] == webhookUrl.split("/")[0]))) channel.createWebhook({
name: "Test",
avatar: ban.client.user.displayAvatarURL()
}).then((hook) => {console.log(hook)
webhook = hook.url
}).catch(console.error)
})
Google said that ok but it works ok but why does it not write something in the log? yes no errors they are defined trust me all works except the .then outside from that you can see over Discord
const Discord = require("discord.js")
const client = require("../index.js").client


let webhookUrl = "1056272617822245025/xBOQMk5sxc4zivGdTFiHp5ICtJihZ5DWv-4kkNu4xBGYBvIPQTDb6GWujYdifbjzXTg6"
let channel = client.guilds.cache.get("469510173954801664").channels.cache.get("729580210634358804")

client.on("guildBanAdd", async (ban) => {
let webhook = `https://discord.com/api/webhooks/${webhookUrl}`
if(!await Promise.allSettled(await channel.fetchWebhooks()).then((res) => res.find((e) => e.value[0] == webhookUrl.split("/")[0]))) channel.createWebhook({
name: "Test",
avatar: ban.client.user.displayAvatarURL()
}).then((hook) => {console.log(hook)
webhook = hook.url
}).catch(console.error)
})
const Discord = require("discord.js")
const client = require("../index.js").client


let webhookUrl = "1056272617822245025/xBOQMk5sxc4zivGdTFiHp5ICtJihZ5DWv-4kkNu4xBGYBvIPQTDb6GWujYdifbjzXTg6"
let channel = client.guilds.cache.get("469510173954801664").channels.cache.get("729580210634358804")

client.on("guildBanAdd", async (ban) => {
let webhook = `https://discord.com/api/webhooks/${webhookUrl}`
if(!await Promise.allSettled(await channel.fetchWebhooks()).then((res) => res.find((e) => e.value[0] == webhookUrl.split("/")[0]))) channel.createWebhook({
name: "Test",
avatar: ban.client.user.displayAvatarURL()
}).then((hook) => {console.log(hook)
webhook = hook.url
}).catch(console.error)
})
in the index after
Want results from more Discord servers?
Add your server
More Posts