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
- 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 OPWdym you tried fetch() and didnt work? How did you try to fetch?
^ The promise will reject if webhook doesn't exist
Yeah, i am confused how can I handle that error ?
DiscordAPIError[10015]: Unknown Webhook
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