def notify(message): print(f'Sending telegram message: {message}') if config.telegram_enabled: Telegram.send_message(message)
import os, sys from telegram import Telegram from publish import log bot = Telegram() std_input = None if not sys.stdin.isatty(): std_input = sys.stdin.readlines() link = bot.link( 'deployment', f"https://gitlab.com/pavsenin/aiodds/-/pipelines/{os.environ['CI_PIPELINE_ID']}" ) if not std_input: message = f"AIOdds {link} was successful" else: message = f"AIOdds {link} failed: {std_input}" log.debug(message) bot.send_message(message)
"Use first /text command to collect the data and generate the image", chat_id=chat_id) while (True): updates = telegram.get_updates(offset) if updates: if offset == 0: offset = updates[0]["update_id"] user_id = updates[0]["message"]["from"]["id"] chat_id = updates[0]["message"]["chat"]["id"] message_text = updates[0]["message"]["text"] if message_text.startswith("/"): if str(user_id) == config("USER_ID"): if message_text == "/fullreport" or message_text == "/start": send_text(chat_id) send_image(chat_id) elif message_text == "/text": send_text(chat_id) elif message_text == "/image": send_image(chat_id) else: mssg = "Sorry this is a personal bot, you can't access it, but you can implement your own bot using the source code :) https://github.com/Daniel-Alba15/Telegram-Crypto-Bot" telegram.send_message(message=mssg, chat_id=chat_id) offset += 1