At least give a Star and Fork the repo
Copy the following code and add it into your plugins directory:
import psutil
import time
from pyrogram import Client, filters
from pyrogram.types import Message
start_time = time.time()
def time_formatter(milliseconds):
minutes, seconds = divmod(int(milliseconds / 1000), 60)
hours, minutes = divmod(minutes, 60)
days, hours = divmod(hours, 24)
weeks, days = divmod(days, 7)
tmp = (((str(weeks) + "ᴡ:") if weeks else "") +
((str(days) + "ᴅ:") if days else "") +
((str(hours) + "ʜ:") if hours else "") +
((str(minutes) + "ᴍ:") if minutes else "") +
((str(seconds) + "s") if seconds else ""))
if not tmp:
return "0s"
if tmp.endswith(":"):
return tmp[:-1]
return tmp
@Client.on_message(filters.command("statuscheck"))
async def status(_, message: Message):
uptime = time_formatter((time.time() - start_time) * 1000)
cpu = psutil.cpu_percent()
TEXT = f"ᴜᴘᴛɪᴍᴇ : {uptime} | ᴄᴘᴜ : {cpu}%"
await message.reply(TEXT)- Get your Necessary Variables
- Update and upgrade:
sudo apt-get update && sudo apt-get upgrade -y - Install required packages:
sudo apt-get install python3-pip
- Upgrade pip:
pip3 install -U pip
- Clone the repository:
git clone https://github.com/Kanha-XD/StatusChecker && cd StatusChecker
- Install requirements:
pip3 install -U -r requirements.txt
- Fill in environment variables:
Press
vi sample.env
Ito edit,Ctrl+Cwhen done, then type:wqto save. - Rename the env file:
mv sample.env .env
- Install tmux and start session:
sudo apt install tmux && tmux - Run the bot:
bash start