mirror of https://github.com/SeanOMik/znc-push.git
added Discord support
This commit is contained in:
parent
ad20898554
commit
98a558cf56
|
@ -25,6 +25,7 @@ conditions. ZNC Push current supports the following services:
|
||||||
* [Pushjet][]
|
* [Pushjet][]
|
||||||
* [Telegram][]
|
* [Telegram][]
|
||||||
* [Slack][]
|
* [Slack][]
|
||||||
|
* [Discord][]
|
||||||
* Custom URL GET requests
|
* Custom URL GET requests
|
||||||
|
|
||||||
This project is still a Work In Progress, but should be functional enough and stable enough
|
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`
|
* `pushjet`
|
||||||
* `telegram`
|
* `telegram`
|
||||||
* `slack`
|
* `slack`
|
||||||
|
* `discord`
|
||||||
* `url`
|
* `url`
|
||||||
|
|
||||||
* `username` Default: ` `
|
* `username` Default: ` `
|
||||||
|
@ -539,6 +541,7 @@ from me and not from my employer. See the `LICENSE` file for details.
|
||||||
[Pushjet]: http://pushjet.io
|
[Pushjet]: http://pushjet.io
|
||||||
[Telegram]: https://telegram.org/
|
[Telegram]: https://telegram.org/
|
||||||
[Slack]: https://slack.com/
|
[Slack]: https://slack.com/
|
||||||
|
[Discord]: https://discord.gg
|
||||||
|
|
||||||
[faq]: https://github.com/jreese/znc-push/blob/master/doc/faq.md
|
[faq]: https://github.com/jreese/znc-push/blob/master/doc/faq.md
|
||||||
[examples]: https://github.com/jreese/znc-push/blob/master/doc/examples.md
|
[examples]: https://github.com/jreese/znc-push/blob/master/doc/examples.md
|
||||||
|
|
23
push.cpp
23
push.cpp
|
@ -671,6 +671,25 @@ class CPushMod : public CModule
|
||||||
|
|
||||||
PutDebug("payload: " + params["payload"]);
|
PutDebug("payload: " + params["payload"]);
|
||||||
}
|
}
|
||||||
|
else if (service == "discord")
|
||||||
|
{
|
||||||
|
if (options["secret"] == "")
|
||||||
|
{
|
||||||
|
PutModule("Error: target (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")
|
else if (service == "pushjet")
|
||||||
{
|
{
|
||||||
if (options["secret"] == "")
|
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)");
|
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")
|
else if (value == "pushjet")
|
||||||
{
|
{
|
||||||
PutModule("Note: Pushjet requires setting 'secret' (service key) option");
|
PutModule("Note: Pushjet requires setting 'secret' (service key) option");
|
||||||
|
|
Loading…
Reference in New Issue