-
-
Save juananpe/edee47d41ed16c0a00eb820e0135bed3 to your computer and use it in GitHub Desktop.
Telegram notifier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import telegram | |
import sys | |
CHAT_ID="XXXXXXX" | |
def get_credentials(file_path): | |
f = open(file_path) | |
return f.readline().strip() | |
def main(): | |
cred = get_credentials("/ruta/a/telegram.token") | |
message = " ".join(sys.argv[1:]) | |
bot = telegram.Bot(token=cred) | |
bot.send_message(chat_id=CHAT_ID, text=message) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment