projectdiscovery / notify

Notify is a Go-based assistance package that enables you to stream the output of several tools (or read from a file) and publish it to a variety of supported platforms.
https://projectdiscovery.io
MIT License
1.31k stars 131 forks source link

"discord" vs. "discordapp" in discord.go #87

Closed droberson closed 2 years ago

droberson commented 3 years ago

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.

IlluminatiFish commented 3 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.

ehsandeep commented 3 years ago

@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