A telegram bot that monitors the uptime and CPU usage of your bots, ensuring they're always up and running. It refreshes automatically and runs 24/7 for your convenience.
API_ID
: Telegram API_ID, get it from my.telegram.org/appsAPI_HASH
: Telegram API_ID, get it from my.telegram.org/appsSESSION_STRING
: A valid Pyrogram session string, get it from @MaybexSessionBotBOT_TOKEN
: A valid bot token, get it from @BotFatherBOT_LIST
: Your bot username list without '@' (Example: Maybexsessionbot MaybexHackBot)CHANNEL_OR_GROUP_ID
: Your channel's or group's Telegram id (Example: -1001246808642)MESSAGE_ID
: Telegram id of message from your channel or group (Example: 10)OWNER_ID
: Owner id (Example: 1357907531 2468097531 3579864213)TIME_ZONE
: Your time zone (Example: Asia/Kolkata)
- Install this using pip3 in whichever bot(pyrogram or telethon) you want to know the status
If Pyrogram
pip3 install git+https://github.com/maybebots/bot-status.git@pyro
If Telethon
pip3 install git+https://github.com/maybebots/bot-status.git@tele
- Import the Client Class with
If Pyrogram
from PyroStatus import PyroClient
If Telethon
from TeleStatus import TeleClient
- Just replace the normal Client with this client. For eg:
If Pyrogram
app = PyroClient(
name="bot",
api_id=69696,
api_hash="",
bot_token=""
)
If Telethon
app = TeleClient(
"bot",
api_id,
api_hash,
).start(bot_token="")
- Thats it now just deploy this repo!
- Add the following code snippet at the beginning of your
__init__.py
file to define thestart_time
variable:
import time
start_time = time.time()
- Now Copy the following code and add it into your repository ( In plugins directory or wherever your plugins exists):
import psutil
import time
from _ import start_time, Client # replace _ where you declare the start_time, Client
from pyrogram import filters
from pyrogram.types import Message
# TeamUltroid/Ultroid
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) + "w:") if weeks else "") +
((str(days) + "d:") if days else "") +
((str(hours) + "h:") if hours else "") +
((str(minutes) + "m:") 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('statusbot') & filters.private)
async def activevc(_, message: Message):
uptime = time_formatter((time.time() - start_time) * 1000)
cpu = psutil.cpu_percent()
TEXT = f"UPTIME: {uptime} | CPU: {cpu}%"
await message.reply(TEXT)
- Now add the bot to your channel and make him admin.
To deploy on a Heroku, follow these steps:
-
Fork this repository
-
Click the Deploy button below
To deploy on a VPS, follow these steps
- Update and upgrade your system packages:
sudo apt-get update && sudo apt-get upgrade -y
- Clone the repository and navigate to the project directory:
git clone https://github.com/maybebots/Bot-Status && cd Bot-Status
- Install the required packages:
pip3 install -U -r requirements.txt
- Create .env using example.env
cp example.env .env
- Now open the .env file using vi .env
- Edit the vars, by pressing I on the keyboard
- After editing save the file using ctrl + c then :wq
- Run the script using Python 3:
python3 main.py