PagerMaid_Plugins_Pyro/keep_online/main.py

16 lines
443 B
Python
Raw Normal View History

import contextlib
from pyrogram.raw.functions.account import UpdateStatus
from pagermaid.services import bot, scheduler
2024-09-28 14:35:08 +00:00
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}")