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

Commit

Permalink
Update /stats command
Browse files Browse the repository at this point in the history
  • Loading branch information
breakdowns authored May 10, 2021
1 parent 3177dab commit ca182b2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
Telegram bot to download music from Deezer powered by [deethon](https://github.com/deethon)
# deploy
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
# credits
- [aykxt](https://github.com/aykxt) for deethon
9 changes: 7 additions & 2 deletions deegram/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import shutil
import shutil, psutil
import time

from telethon import Button, events
Expand Down Expand Up @@ -47,7 +47,12 @@ async def stats(event: NewMessage.Event):
total = get_readable_file_size(total)
used = get_readable_file_size(used)
free = get_readable_file_size(free)
await event.reply(translate.STATS_MSG.format(current_time, total, used, free))
upload = get_readable_file_size(psutil.net_io_counters().bytes_sent)
download = get_readable_file_size(psutil.net_io_counters().bytes_recv)
cpu = psutil.cpu_percent(interval=0.5)
ram = psutil.virtual_memory().percent
disk = psutil.disk_usage('/').percent
await event.reply(translate.STATS_MSG.format(current_time, total, used, free, upload, download, cpu, ram, disk))
raise StopPropagation


Expand Down
17 changes: 11 additions & 6 deletions deegram/utils/translate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "0.2.1"
VERSION = "0.2.2"
CREATOR = "@hafitzXD"
BOT_NAME = "Deezfitz"
WELCOME_MSG = (
Expand All @@ -10,13 +10,18 @@
f"ℹ Version: {VERSION}"
)
STATS_MSG = (
"Bot Uptime: {}\n"
"Total disk space: {}\n"
"Used: {}\n"
"Free: {}"
"**Bot Uptime:** {}\n"
"**Total disk space:** {}\n"
"**Used:** {} "
"**Free:** {}\n\n"
"📊Data Usage📊\n**Upload:** {}\n"
"**Download:** {}\n\n"
"**CPU:** {}\n"
"**RAM:** {}\n"
"**DISK:** {}"
)
HELP_MSG = (
"Search by album or track or just send me a Deezer track or album link and I will download it for you :)\n\n"
"Search by album or track or just send me a Deezer track or album link and I will download it for you 🙂\n\n"
"**List of all commands:**\n"
"/start - Get the welcome message\n"
"/help - Get this message\n"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ aiodns~=2.0.0
cchardet~=2.1.7
deethon~=0.5.1
uvloop~=0.15.2
psutil

0 comments on commit ca182b2

Please sign in to comment.