From ed38e1ccb0c854d88c895888201646a66c82fb8d Mon Sep 17 00:00:00 2001 From: Banana Date: Wed, 5 Jan 2022 20:11:07 +0100 Subject: [PATCH] simple telegram notify --- bash/telegram-notify.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 bash/telegram-notify.sh diff --git a/bash/telegram-notify.sh b/bash/telegram-notify.sh new file mode 100644 index 0000000..a40f66c --- /dev/null +++ b/bash/telegram-notify.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE +# +# You should have received a copy of the +# COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 +# along with this program. If not, see http://www.sun.com/cddl/cddl.html +# +# 2022 http://www.bananas-playground.net + +# this is a simple bash script witch accepts a text input as arg1 or pipe +# and writes this text to your telegram chat +# https://core.telegram.org/bots +# https://core.telegram.org/bots#6-botfather + + +BOTTOKEN="xxxxxxxxxxxxxxxx" +CHAT_ID="xxxxxxxxxxx" +URL="https://api.telegram.org/bot$BOTTOKEN/sendMessage" + +INPUT_TEXT="Something is ready..." +if test -n "$1"; then + INPUT_TEXT=$1; +elif test ! -t 0; then + INPUT_TEXT=$( /dev/null 2>&1 -- 2.39.5