Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit ca182b2

Browse files
authored
Update /stats command
1 parent 3177dab commit ca182b2

4 files changed

Lines changed: 21 additions & 8 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
Telegram bot to download music from Deezer powered by [deethon](https://github.com/deethon)
44
# deploy
55
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
6+
# credits
7+
- [aykxt](https://github.com/aykxt) for deethon

deegram/__main__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import shutil
1+
import shutil, psutil
22
import time
33

44
from telethon import Button, events
@@ -47,7 +47,12 @@ async def stats(event: NewMessage.Event):
4747
total = get_readable_file_size(total)
4848
used = get_readable_file_size(used)
4949
free = get_readable_file_size(free)
50-
await event.reply(translate.STATS_MSG.format(current_time, total, used, free))
50+
upload = get_readable_file_size(psutil.net_io_counters().bytes_sent)
51+
download = get_readable_file_size(psutil.net_io_counters().bytes_recv)
52+
cpu = psutil.cpu_percent(interval=0.5)
53+
ram = psutil.virtual_memory().percent
54+
disk = psutil.disk_usage('/').percent
55+
await event.reply(translate.STATS_MSG.format(current_time, total, used, free, upload, download, cpu, ram, disk))
5156
raise StopPropagation
5257

5358

deegram/utils/translate.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = "0.2.1"
1+
VERSION = "0.2.2"
22
CREATOR = "@hafitzXD"
33
BOT_NAME = "Deezfitz"
44
WELCOME_MSG = (
@@ -10,13 +10,18 @@
1010
f"ℹ Version: {VERSION}"
1111
)
1212
STATS_MSG = (
13-
"Bot Uptime: {}\n"
14-
"Total disk space: {}\n"
15-
"Used: {}\n"
16-
"Free: {}"
13+
"**Bot Uptime:** {}\n"
14+
"**Total disk space:** {}\n"
15+
"**Used:** {} "
16+
"**Free:** {}\n\n"
17+
"📊Data Usage📊\n**Upload:** {}\n"
18+
"**Download:** {}\n\n"
19+
"**CPU:** {}\n"
20+
"**RAM:** {}\n"
21+
"**DISK:** {}"
1722
)
1823
HELP_MSG = (
19-
"Search by album or track or just send me a Deezer track or album link and I will download it for you :)\n\n"
24+
"Search by album or track or just send me a Deezer track or album link and I will download it for you 🙂\n\n"
2025
"**List of all commands:**\n"
2126
"/start - Get the welcome message\n"
2227
"/help - Get this message\n"

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ aiodns~=2.0.0
66
cchardet~=2.1.7
77
deethon~=0.5.1
88
uvloop~=0.15.2
9+
psutil

0 commit comments

Comments
 (0)