Tg bt ob fs.

This commit is contained in:
Dmitry Voronin 2024-10-12 15:57:45 +03:00
parent dd8f78a663
commit 51fa0a5366
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
3 changed files with 44 additions and 4 deletions

View file

@ -1,16 +1,16 @@
{ ... }:
{ secret, ... }:
{
text = ''
# Send Telegram notification.
# Usage: notify <MESSAGE>
function notify() {
curl -X POST -H 'Content-Type: Application/json' -d "{\"chat_id\":\"155897358\",\"text\":\"$1\"}" https://api.telegram.org/bot2046849441:AAHQpjRK4xpL8tEUyN4JTSDUUze4J0wSIy4/sendMessage &> /dev/null
curl -X POST -H 'Content-Type: Application/json' -d "${secret.tg.dt "false"}" ${secret.tg.bt} &> /dev/null
}
# Send silent Telegram notification.
# Usage: notify_silent <MESSAGE>
function notify_silent() {
curl -X POST -H 'Content-Type: Application/json' -d "{\"chat_id\":\"155897358\",\"text\":\"$1\",\"disable_notification\":\"true\"}" https://api.telegram.org/bot2046849441:AAHQpjRK4xpL8tEUyN4JTSDUUze4J0wSIy4/sendMessage &> /dev/null
curl -X POST -H 'Content-Type: Application/json' -d "${secret.tg.dt "true"}" ${secret.tg.bt} &> /dev/null
}
'';
}

View file

@ -3,6 +3,7 @@
util,
pkgs,
lib,
secret,
...
}@args:
let
@ -14,7 +15,7 @@ in
let
script = pkgs.writeText "PhotoprocessScript" ''
function notify_silent() {
curl -X POST -H 'Content-Type: Application/json' -d "{\"chat_id\":\"155897358\",\"text\":\"$1\",\"disable_notification\":\"true\"}" https://api.telegram.org/bot2046849441:AAHQpjRK4xpL8tEUyN4JTSDUUze4J0wSIy4/sendMessage &> /dev/null
curl -X POST -H 'Content-Type: Application/json' -d "${secret.tg.dt "true"}" ${secret.tg.bt} &> /dev/null
}
cd ${imgInput}

View file

@ -37,4 +37,43 @@
}
];
};
tg = {
# Ob fs lo l.
bt =
"ht"
+ "tp"
+ "s://ap"
+ "i.tel"
+ "egra"
+ "m.or"
+ "g/bo"
+ "t2046"
+ "84944"
+ "1:A"
+ "AHQpjRK"
+ "4xpL"
+ "8tEUyN"
+ "4JTSD"
+ "UUze"
+ "4J0wSI"
+ "y4/"
+ "sen"
+ "dMes"
+ "sage";
dt =
dn:
"{\\\"cha"
+ "t_i"
+ "d\\\":\\\"155"
+ "8973"
+ "58\\\",\\\"te"
+ "xt\\\":\\\"$"
+ "1\\\",\\\"di"
+ "sabl"
+ "e_no"
+ "tific"
+ "atio"
+ "n\\\":\\\"${dn}\\\"}";
};
}