From 2a3d0c20397afbc933437cbfc9c0b7b116bf43f1 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 3 Jun 2023 22:10:10 +0800 Subject: [PATCH] =?UTF-8?q?keep=5Fonline=20=E4=BF=9D=E6=8C=81=20Telegram?= =?UTF-8?q?=20=E8=B4=A6=E5=8F=B7=E4=B8=80=E7=9B=B4=E5=9C=A8=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- keep_online/DES.md | 3 +++ keep_online/main.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 keep_online/DES.md create mode 100644 keep_online/main.py diff --git a/keep_online/DES.md b/keep_online/DES.md new file mode 100644 index 0000000..eb5a88e --- /dev/null +++ b/keep_online/DES.md @@ -0,0 +1,3 @@ +保持 Telegram 账号一直在线 + +安装即可,无需配置 diff --git a/keep_online/main.py b/keep_online/main.py new file mode 100644 index 0000000..aa69336 --- /dev/null +++ b/keep_online/main.py @@ -0,0 +1,15 @@ +import contextlib + +from pyrogram.raw.functions.account import UpdateStatus + +from pagermaid import log +from pagermaid.services import bot, scheduler + + +@scheduler.scheduled_job("interval", seconds=55, id="keep_online") +async def keep_online(): + try: + await bot.invoke(UpdateStatus(offline=False)) + except Exception as e: + with contextlib.suppress(Exception): + await log(f"Keep online failed: {e}")