Bigmanekb (обсуждение | вклад) (Новая страница: «<syntaxhighlight lang="js" line="1"> function sendToTelegramSilent(text) { HttpClient.POST("https://api.telegram.org") .path("bot" + "666666666:AABBCCddEeffggeeHH-IIJJkKLlMmnno_oP") .path("sendMessage") .queryString("chat_id", 666666666) .queryString("text", text) .queryString("parse_mode", "Markdown") .queryString("disable_notification", true) .send() } </syntaxhighlight>») Метка: wikieditor |
Bigmanekb (обсуждение | вклад) Нет описания правки Метка: wikieditor |
||
Строка 1: | Строка 1: | ||
<syntaxhighlight lang="js" line="1"> | <syntaxhighlight lang="js" line="1"> | ||
function | let chatIDs = ["666666666"]; | ||
HttpClient.POST("https://api.telegram.org") | let token = "666666666:AABBCCddEeffggeeHH-IIJJkKLlMmnno_oP" | ||
function sendToTelegram(text, notify) { | |||
try { | |||
if (!Array.isArray(text)) | |||
text = [text]; | |||
. | chatIDs.forEach(function (chatID) { | ||
} | HttpClient.POST("https://api.telegram.org") | ||
.path("bot" + token) | |||
.path("sendMessage") | |||
.queryString("chat_id", chatID) | |||
.queryString("text", text.join("\n")) | |||
.queryString("parse_mode", "Markdown") | |||
.queryString("disable_notification", notify == null ? false : !notify) | |||
.send() | |||
}) | |||
} catch (e) { | |||
log.error(e.message); | |||
} | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> |
Версия от 18:53, 14 ноября 2022
let chatIDs = ["666666666"];
let token = "666666666:AABBCCddEeffggeeHH-IIJJkKLlMmnno_oP"
function sendToTelegram(text, notify) {
try {
if (!Array.isArray(text))
text = [text];
chatIDs.forEach(function (chatID) {
HttpClient.POST("https://api.telegram.org")
.path("bot" + token)
.path("sendMessage")
.queryString("chat_id", chatID)
.queryString("text", text.join("\n"))
.queryString("parse_mode", "Markdown")
.queryString("disable_notification", notify == null ? false : !notify)
.send()
})
} catch (e) {
log.error(e.message);
}
}