new: bot sending graphs

This commit is contained in:
Simone Margaritelli 2021-04-08 22:13:57 +02:00
commit 6393dc1ea5
2 changed files with 41 additions and 20 deletions

View file

@ -1,4 +1,6 @@
function sendMessage(message) {
log(message);
var url = 'https://api.telegram.org/bot' + telegramToken +
'/sendMessage?chat_id=' + telegramChatId +
'&text=' + http.Encode(message);
@ -7,4 +9,10 @@ function sendMessage(message) {
if( resp.Error ) {
log("error while running sending telegram message: " + resp.Error.Error());
}
}
function sendPhoto(path) {
var url = 'https://api.telegram.org/bot' + telegramToken + '/sendPhoto';
var cmd = 'curl -s -X POST "' + url + '" -F chat_id=' + telegramChatId + ' -F photo="@' + path + '"';
run("!"+cmd);
}