taslim19
commited on
Commit
·
ab9e43d
1
Parent(s):
39a9010
debug: Add logging to ping command to diagnose issues
Browse files- DragMusic/plugins/tools/ping.py +22 -12
DragMusic/plugins/tools/ping.py
CHANGED
@@ -14,15 +14,25 @@ from config import BANNED_USERS, PING_IMG_URL, lyrical
|
|
14 |
@app.on_message(filters.command(["ping", "alive"]) & ~BANNED_USERS)
|
15 |
@language
|
16 |
async def ping_com(client, message: Message, _):
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
@app.on_message(filters.command(["ping", "alive"]) & ~BANNED_USERS)
|
15 |
@language
|
16 |
async def ping_com(client, message: Message, _):
|
17 |
+
print(f"Ping command triggered by user {message.from_user.id}")
|
18 |
+
try:
|
19 |
+
start = datetime.now()
|
20 |
+
print("Sending initial photo response...")
|
21 |
+
response = await message.reply_photo(
|
22 |
+
photo=PING_IMG_URL,
|
23 |
+
caption=_["ping_1"].format(app.mention),
|
24 |
+
)
|
25 |
+
print("Getting pytgping...")
|
26 |
+
pytgping = await Drag.ping()
|
27 |
+
print("Getting system stats...")
|
28 |
+
UP, CPU, RAM, DISK = await bot_sys_stats()
|
29 |
+
resp = (datetime.now() - start).microseconds / 1000
|
30 |
+
print("Editing response...")
|
31 |
+
await response.edit_text(
|
32 |
+
_["ping_2"].format(resp, app.mention, UP, RAM, CPU, DISK, pytgping),
|
33 |
+
reply_markup=supp_markup(_),
|
34 |
+
)
|
35 |
+
print("Ping command completed successfully")
|
36 |
+
except Exception as e:
|
37 |
+
print(f"Error in ping command: {e}")
|
38 |
+
await message.reply_text(f"Error in ping command: {e}")
|