mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
fix(telegram-bot): better logging and reporting
This commit is contained in:
@@ -13,14 +13,14 @@ with lib; let
|
|||||||
startAt = bot.time;
|
startAt = bot.time;
|
||||||
serviceConfig.Type = "oneshot";
|
serviceConfig.Type = "oneshot";
|
||||||
wants = ["network-online.target"];
|
wants = ["network-online.target"];
|
||||||
script = strings.concatStringsSep "\n" (["QUOTE=$(${bot.command})" "if [ -n \"$QUOTE\" ]; then"]
|
script = strings.concatStringsSep "\n" (["QUOTE=$(${bot.command})" "if [ -n \"$QUOTE\" ]; then" "echo $QUOTE >&2"]
|
||||||
++ map (chatId: ''
|
++ map (chatId: ''
|
||||||
${pkgs.curl}/bin/curl -s -X POST "https://api.telegram.org/bot${bot.token}/sendMessage" \
|
${pkgs.curl}/bin/curl -X POST "https://api.telegram.org/bot${bot.token}/sendMessage" \
|
||||||
-d chat_id="${chatId}" \
|
-d chat_id="${chatId}" \
|
||||||
-d text="$QUOTE" ${
|
-d text="$QUOTE" ${
|
||||||
lib.strings.optionalString (bot.parseMode != null)
|
lib.strings.optionalString (bot.parseMode != null)
|
||||||
"-d parse_mode=${bot.parseMode}"
|
"-d parse_mode=${bot.parseMode}"
|
||||||
}
|
} | ${pkgs.jq}/bin/jq -e .ok
|
||||||
'')
|
'')
|
||||||
bot.chatIds
|
bot.chatIds
|
||||||
++ ["fi"]);
|
++ ["fi"]);
|
||||||
|
|||||||
Reference in New Issue
Block a user