mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-24 16:39:59 +00:00
keep_online 保持 Telegram 账号一直在线
This commit is contained in:
parent
1abd1edb5c
commit
2a3d0c2039
3
keep_online/DES.md
Normal file
3
keep_online/DES.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
保持 Telegram 账号一直在线
|
||||||
|
|
||||||
|
安装即可,无需配置
|
15
keep_online/main.py
Normal file
15
keep_online/main.py
Normal file
@ -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}")
|
Loading…
Reference in New Issue
Block a user