(text)
| 17 | counterOn = {} |
| 18 | |
| 19 | def _send(text): |
| 20 | chat_id = os.getenv('TG_CHAT_ID') |
| 21 | bot_token = os.environ.get('TG_BOT_TOKEN') |
| 22 | url = f"https://api.telegram.org/bot{bot_token}/sendMessage?parse_mode=HTML&disable_web_page_preview=true&chat_id=" + chat_id + "&text=" + text |
| 23 | try: |
| 24 | requests.get(url) |
| 25 | except Exception as e: |
| 26 | print("catch exception: ", traceback.format_exc()) |
| 27 | |
| 28 | def send2tg(srv, flag): |
| 29 | if srv not in counterOff: |