Giter Club home page Giter Club logo

stranger-bot-status's Introduction

Telegram Bot Status Repo

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.

made-with-python
Stars Forks Watchers
Repository Size Contributors Issues

Config Vars

  1. API_ID : Telegram API_ID, get it from my.telegram.org/apps
  2. API_HASH : Telegram API_ID, get it from my.telegram.org/apps
  3. SESSION_STRING : A valid Pyrogram session string, get it from @StringSesssionGeneratorRobot
  4. BOT_TOKEN : A valid bot token, get it from @BotFather
  5. BOT_LIST : Your bot username list without '@' (Example: StringSesssionGeneratorRobot StrangerSuperbot)
  6. CHANNEL_OR_GROUP_ID : Your channel's or group's Telegram id (Example: -1002018556839)
  7. MESSAGE_ID : Telegram id of message from your channel or group (Example: 10)
  8. OWNER_ID : Owner id (Example: 6919199044 6762113050)
  9. TIME_ZONE: Your time zone (Example: Asia/Kolkata)

Example

image

Tutorial

Method 1 (Easy)

  1. Install this using pip3 in whichever bot(pyrogram or telethon) you want to know the status

If Pyrogram

pip3 install git+https://github.com/itzshukla/STRANGER-BOT-STATUS.git@pyro

If Telethon

pip3 install git+https://github.com/itzshukla/STRANGER-BOT-STATUS.git@tele
  1. Import the Client Class with

If Pyrogram

from PyroStatus import PyroClient

If Telethon

from TeleStatus import TeleClient
  1. 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="")
  1. Thats it now just deploy this repo!

Method 2 (Manual)

  1. Add the following code snippet at the beginning of your __init__.py file to define the start_time variable:
import time

start_time = time.time()
  1. 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)
  1. Now add the bot to your channel and make him admin.

Deployment Methods

Heroku

To deploy on a Heroku, follow these steps:

  1. Fork this repository

  2. Click the Deploy button below

Deploy

Vps

To deploy on a VPS, follow these steps

  1. Update and upgrade your system packages:
sudo apt-get update && sudo apt-get upgrade -y
  1. Clone the repository and navigate to the project directory:
git clone https://github.com/itzshukla/STRANGER-BOT-STATUS && cd Bot-Status
  1. Install the required packages:
pip3 install -U -r requirements.txt
  1. Create .env using example.env
cp example.env .env
  1. Now open the .env file using vi .env
  2. Edit the vars, by pressing I on the keyboard
  3. After editing save the file using ctrl + c then :wq
  4. Run the script using Python 3:
python3 main.py

Support

Credits

stranger-bot-status's People

Contributors

surajx21 avatar itzshukla avatar

Stargazers

Honeyxslayer avatar RAJ RAUTRAY avatar ⌯ ˹sʜɪᴠᴀɴsʜ ʜᴇʀᴇ˼ ™ ~ [ᴀғᴋ]↻🇮🇳 avatar STRANGEROP avatar  avatar

Watchers

 avatar

Forkers

honeyxslayer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.