Check if Webhook Exists

Hi, I have webhook ID and Token but want to check if that webhook exists or not, I tried to use fetch() but it didn't work, any idea how to check if the webhook exists as people can manually delete it and I don't want my bot to stop suddenly because of that.
6 Replies
d.js toolkit
d.js toolkit8mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
NyR
NyR8mo ago
Wdym you tried fetch() and didnt work? How did you try to fetch?
d.js docs
d.js docs8mo ago
:method: Client#fetchWebhook() Obtains a webhook from Discord.
NyR
NyR8mo ago
^ The promise will reject if webhook doesn't exist
Legita
LegitaOP8mo ago
Yeah, i am confused how can I handle that error ? DiscordAPIError[10015]: Unknown Webhook
NyR
NyR8mo ago
Yeah so that means webhook doesn't exist, you catch the error, then check if error message(or code) is equal to what you sent and then handle accordingly
Want results from more Discord servers?
Add your server