Closed droberson closed 2 years ago
discordapp.com is the legacy domain for discord, therefore most if not all their webhooks should be on the discord.com domain from now. Realistically I think checking against a regex pattern would be the best course of action here.
@droberson this is now fixed in the dev version, both domains are allowed now in the config file, you can install the dev
version with go install -v github.com/projectdiscovery/notify/cmd/notify@dev
It appears that discord.go expects DiscordWebHookURL to use "discord.com" as the domain for webhook URLs: https://github.com/projectdiscovery/notify/blob/master/pkg/providers/discord/discord.go#L43
Copying a webhook's URL from Discord's settings currently yields an URL with "discordapp.com." Pasting webhook URLs copied from Discord into provider-config.yaml results in the following error when running notify:
[ERR] failed to send discord notification for id: alert : token missing from config URL
Changing "discordapp.com" in the webhook's URL to the expected "discord.com" results in a valid configuration.
I am not sure if, at one point in time, Discord used "discord.com" instead of "discordapp.com" for webhook URLs or if this was a typo.
Trimming both "https://discord.com/api/webhooks/" and "https://discordapp.com/api/webhooks/" from the discordTokens variable seems like an easy solution that would not break existing configurations and also allow pasting webhook URLs copied directly from Discord.