mirror of https://github.com/SeanOMik/znc-push.git
Support telegram
Signed-off-by: Wen-chien Jesse Sung <jesse@cola.voip.idv.tw>
This commit is contained in:
parent
3c6a6a5ead
commit
c01d078806
18
push.cpp
18
push.cpp
|
@ -676,6 +676,20 @@ class CPushMod : public CModule
|
||||||
params["level"] = options["message_priority"];
|
params["level"] = options["message_priority"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (service == "telegram")
|
||||||
|
{
|
||||||
|
if ((options["secret"] == "") || (options["target"] ==""))
|
||||||
|
{
|
||||||
|
PutModule("Error: secret (API key) or target (chat_id) not set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
service_host = "api.telegram.org";
|
||||||
|
service_url = "/bot" + options["secret"] + "/sendMessage";
|
||||||
|
|
||||||
|
params["chat_id"] = options["target"];
|
||||||
|
params["text"] = message_content;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PutModule("Error: service type not selected");
|
PutModule("Error: service type not selected");
|
||||||
|
@ -1423,6 +1437,10 @@ class CPushMod : public CModule
|
||||||
{
|
{
|
||||||
PutModule("Note: Pushjet requires setting 'secret' (service key) option");
|
PutModule("Note: Pushjet requires setting 'secret' (service key) option");
|
||||||
}
|
}
|
||||||
|
else if (value == "telegram")
|
||||||
|
{
|
||||||
|
PutModule("Note: Telegram requires setting both the 'secret' (api key) and 'target' (chat_id)");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PutModule("Error: unknown service name");
|
PutModule("Error: unknown service name");
|
||||||
|
|
Loading…
Reference in New Issue