Spaces:
Running
Running
taslim19
commited on
Commit
·
393f601
1
Parent(s):
defe576
fix: correct ping command logic
Browse files
DragMusic/plugins/tools/ping.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
from datetime import datetime
|
|
|
2 |
from pyrogram import filters
|
3 |
from pyrogram.types import Message
|
4 |
|
@@ -11,16 +12,16 @@ from config import BANNED_USERS, PING_IMG_URL
|
|
11 |
@app.on_message(filters.command(["ping", "alive"]) & ~BANNED_USERS)
|
12 |
@language
|
13 |
async def ping_com(client, message: Message, _):
|
14 |
-
|
15 |
response = await message.reply_photo(
|
16 |
photo=PING_IMG_URL,
|
17 |
-
caption=_["ping_1"],
|
18 |
)
|
19 |
-
end_time = datetime.now()
|
20 |
-
ping_time = (end_time - start_time).microseconds / 1000
|
21 |
pytgping = await Drag.ping()
|
22 |
-
|
23 |
-
await response.edit_text(
|
|
|
|
|
24 |
|
25 |
# Start the Pyrogram bot
|
26 |
if __name__ == "__main__":
|
|
|
1 |
from datetime import datetime
|
2 |
+
|
3 |
from pyrogram import filters
|
4 |
from pyrogram.types import Message
|
5 |
|
|
|
12 |
@app.on_message(filters.command(["ping", "alive"]) & ~BANNED_USERS)
|
13 |
@language
|
14 |
async def ping_com(client, message: Message, _):
|
15 |
+
start = datetime.now()
|
16 |
response = await message.reply_photo(
|
17 |
photo=PING_IMG_URL,
|
18 |
+
caption=_["ping_1"].format(app.mention),
|
19 |
)
|
|
|
|
|
20 |
pytgping = await Drag.ping()
|
21 |
+
resp = (datetime.now() - start).microseconds / 1000
|
22 |
+
await response.edit_text(
|
23 |
+
f"**Pong!**\n`{resp:.2f} ms`\n\n**Py-TgCalls:** `{pytgping} ms`"
|
24 |
+
)
|
25 |
|
26 |
# Start the Pyrogram bot
|
27 |
if __name__ == "__main__":
|