Merge pull request #235 from Stonebound/feature/discord

added discord.gg support via webhook
This commit is contained in:
John Reese 2017-07-21 19:21:08 -04:00 committed by GitHub
commit e077fd97db
2 changed files with 26 additions and 0 deletions

View File

@ -25,6 +25,7 @@ conditions. ZNC Push current supports the following services:
* [Pushjet][]
* [Telegram][]
* [Slack][]
* [Discord][]
* Custom URL GET requests
This project is still a Work In Progress, but should be functional enough and stable enough
@ -252,6 +253,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
* `pushjet`
* `telegram`
* `slack`
* `discord`
* `url`
* `username` Default: ` `
@ -539,6 +541,7 @@ from me and not from my employer. See the `LICENSE` file for details.
[Pushjet]: http://pushjet.io
[Telegram]: https://telegram.org/
[Slack]: https://slack.com/
[Discord]: https://discord.gg
[faq]: https://github.com/jreese/znc-push/blob/master/doc/faq.md
[examples]: https://github.com/jreese/znc-push/blob/master/doc/examples.md

View File

@ -671,6 +671,25 @@ class CPushMod : public CModule
PutDebug("payload: " + params["payload"]);
}
else if (service == "discord")
{
if (options["secret"] == "")
{
PutModule("Error: secret (from webhook, e.g. 111111111111111111/abcdefghijklmopqrstuvwxyz1234567890-ABCDEFGHIJKLMNOPQRSTUVWXYZ123456) not set");
return;
}
service_host = "discordapp.com";
service_url = "/api/webhooks/" + options["secret"];
if (options["username"] != "")
{
params["username"] = options["username"];
}
params["content"] = message_content;
}
else if (service == "pushjet")
{
if (options["secret"] == "")
@ -1444,6 +1463,10 @@ class CPushMod : public CModule
{
PutModule("Note: Slack requires setting 'secret' (from webhook) and 'target' (channel or username), optional 'username' (bot name)");
}
else if (value == "discord")
{
PutModule("Note: Discord requires setting 'secret' (from webhook), optional 'username' (bot name)");
}
else if (value == "pushjet")
{
PutModule("Note: Pushjet requires setting 'secret' (service key) option");