From ea1242933bd9128aaa454c4ff6c5fcc92a55a641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Fri, 29 Jul 2022 17:42:14 +0200 Subject: [PATCH] fix(telegram-bot): better logging and reporting --- modules/telegram-bot.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/telegram-bot.nix b/modules/telegram-bot.nix index 5eeb6e1..42d1664 100644 --- a/modules/telegram-bot.nix +++ b/modules/telegram-bot.nix @@ -13,14 +13,14 @@ with lib; let startAt = bot.time; serviceConfig.Type = "oneshot"; 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: '' - ${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 text="$QUOTE" ${ lib.strings.optionalString (bot.parseMode != null) "-d parse_mode=${bot.parseMode}" - } + } | ${pkgs.jq}/bin/jq -e .ok '') bot.chatIds ++ ["fi"]);