File size: 1,418 Bytes
a8e9b84 393f601 defe576 a8e9b84 54ef848 b14aa03 a8e9b84 ab9e43d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
from datetime import datetime
from pyrogram import filters
from pyrogram.types import Message
from DragMusic import app
from DragMusic.core.call import Drag
from DragMusic.utils.decorators.language import language
from DragMusic.utils.inline.extras import supp_markup
from DragMusic.utils.sys import bot_sys_stats
from config import BANNED_USERS, PING_IMG_URL, lyrical
@app.on_message(filters.command(["ping", "alive"]) & ~BANNED_USERS)
@language
async def ping_com(client, message: Message, _):
print(f"Ping command triggered by user {message.from_user.id}")
try:
start = datetime.now()
print("Sending initial photo response...")
response = await message.reply_photo(
photo=PING_IMG_URL,
caption=_["ping_1"].format(app.mention),
)
print("Getting pytgping...")
pytgping = await Drag.ping()
print("Getting system stats...")
UP, CPU, RAM, DISK = await bot_sys_stats()
resp = (datetime.now() - start).microseconds / 1000
print("Editing response...")
await response.edit_text(
_["ping_2"].format(resp, app.mention, UP, RAM, CPU, DISK, pytgping),
reply_markup=supp_markup(_),
)
print("Ping command completed successfully")
except Exception as e:
print(f"Error in ping command: {e}")
await message.reply_text(f"Error in ping command: {e}")
|