PagerMaid_Plugins_Pyro/keep_online/main.py
xtaodada fb5a3f5baf
All checks were successful
Github commit to telegram / build (push) Successful in 13s
♻️ Reformat All Plugins
2024-09-28 22:35:08 +08:00

16 lines
443 B
Python

import contextlib
from pyrogram.raw.functions.account import UpdateStatus
from pagermaid.services import bot, scheduler
from pagermaid.utils.bot_utils import log
@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}")