Closed KhafraDev closed 4 years ago
According to the docs, Webhook#token cannot be null/undefined (and it wouldn't make sense for it to be, as you can't use a webhook without it).
This used to be true until Discord added server announcement following, webhooks that are used for following don't have the token and have type 2 (images below)
This PR should solve this
According to the docs, Webhook#token cannot be null/undefined (and it wouldn't make sense for it to be, as you can't use a webhook without it).
This information is wrong, according to discords documentation .token
can be undefined, and that will be the case for the "webhooks" generated from following an announcement channel. You can not utilize these with a bot, and should filter them out.
webhooks.filter(hook => hook.token)
or a similar approach should do.
Nonetheless this needs to be edited in 11.5-dev and 12.0.0-dev and typings.
@almostSouji this issue occurs when creating or getting an existing webhook (as shown in my code above). When getting the URL manually, it shows a token, and the ID is the same as the Webhook object shown in the output. I am not using a webhook for announcements, but a "normal" one that was generated using the code shown in my initial message. When referring to the "docs" I was referring to the discord.js.org docs, my bad - https://discord.js.org/#/docs/main/master/class/Webhook?scrollTo=token
@MBR-0001 Thanks for the info, last time I was active in bot development that announcement hadn't came out yet. I'll check out the PR!
Thank you both for the quick responses
Please describe the problem you are having in as much detail as possible:
(and it wouldn't make sense for it to be, as you can't use a webhook without it).Include a reproducible code sample here, if possible:
Further details: