forked from sultansq/kiu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ping.py
36 lines (32 loc) · 1 KB
/
ping.py
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
from datetime import datetime
from pyrogram import filters
from pyrogram.types import Message
from strings.filters import command
from config import BANNED_USERS, MUSIC_BOT_NAME, PING_IMG_URL
from strings import get_command
from AnonX import app
from AnonX.core.call import Anon
from AnonX.utils import bot_sys_stats
from AnonX.utils.decorators.language import language
from AnonX.utils.inline.play import close_keyboard
### Commands
PING_COMMAND = get_command("PING_COMMAND")
@app.on_message(
command(PING_COMMAND)
)
@language
async def ping_com(client, message: Message, _):
response = await message.reply_photo(
photo=PING_IMG_URL,
caption=_["ping_1"],
)
start = datetime.now()
pytgping = await Anon.ping()
UP, CPU, RAM, DISK = await bot_sys_stats()
resp = (datetime.now() - start).microseconds / 1000
await response.edit_text(
_["ping_2"].format(
resp, MUSIC_BOT_NAME, UP, RAM, CPU, DISK, pytgping
),
reply_markup=close_keyboard
)