Skip to content

A Simple Script to Pretify All your Bots for your Channel in One Status..

License

Notifications You must be signed in to change notification settings

SilentDemonSD/TgBotStatus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tg Updater Logo

TgBotStatus

A Simple Telegram Status Updater to Pretify All your Bots for your Channel in single Status... with Advance Stats


📇 Features

  • Sequential Status Check
  • Progress Bar on Checking
  • Calculate Ping Time of Response
  • Show Available/Working Bots
  • Fresh Clean UI
  • Set Custom Host for Each Bot(s)
  • Support for MLTB Advanced Status (More Status Details)

📦 Repo Config SetUp:

.env File SetUp :

  • API_ID: Authenticate your Telegram account, get this from https://my.telegram.org.
  • API_HASH: Authenticate your Telegram account, get this from https://my.telegram.org.
  • PYRO_SESSION: Pyrogram User Session to Access Bots, Generate from Here
  • HEADER_MSG : Put Header Msg for 1st Line.

    Default: Telegram Bot Status :

  • TIME_ZONE: Time Zone for Sync with your Local Time

    Default: Asia/Kolkata

  • BOT_TOKEN: (Optional) Only Required if MSG_BUTTONS is added for Post Buttons.
  • MSG_BUTTONS: Make Awesome Telegram Buttons to show at the bottom of the Text.

    Unlimited Buttons with Any Design !

    • How to Use ?
      • Separator : # for Text and Link, | for Button Separator, || for Next Line Separator
      • Sample Use Cases:
        Input:
        b_text1#b_url|b_text2#b_url||b_text3#b_url|b_text4#b_url
        
        Output: (Buttons)
        [ b_text1 ][ b_text2 ]
        [ b_text3 ][ b_text4 ]
        
        Input:
        b_text1#b_url||b_text2#b_url|b_text3#b_url|b_text4#b_url
        
        Output: (Buttons)
        [            b_text1            ]
        [ b_text2 ][ b_text3 ][ b_text4 ]
        
        Input:
        b_text1#b_url||b_text2#b_url||b_text3#b_url
        [ b_text1 ]
        [ b_text2 ]
        [ b_text3 ]
        

config.json File SetUp :

  • Sections are Divided into 2 Parts:

    1. Bots Details: bot1: Indentifier Name (Can be Anything But Unique for Every Bot)
    Variable Value Required
    base_url_of_bot If MLTB bot, give Base URL of it. (Optional)
    host Host name where you have deployed *Required
    bot_uname Bot Username without @ *Required
    1. Chat Details: chat1: Indentifier Name (Can be Anything But Unique for Every Bot)
    Variable Value Required
    chat_id chat id of the Target Channel or Group *Required
    message_id message id of the Message to Edit. If link is https://t.me/cha_uname/123 Here, 123 is the Message ID *Required

🪧 Sample JSON Format

{
  "bots": {
    "bot1": {
      "base_url_of_bot": "http://0.0.0.0",
      "host": "HK",
      "bot_uname": "@botfather"
    },
    "bot2": {
      "host": "Vps",
      "bot_uname": "@botfather"
    }
    ...more
  },
  "channels": {
    "chat1": {
      "chat_id": "-100xxxxxx",
      "message_id": "54321"
    },
    "chat2": {
      "chat_id": "-100xxxxxxx",
      "message_id": "12345"
    }
    ...more
  }
}

Required Config Setup :

Either Add these URL to these Variables or Directly Add a File on Repo as File name Specified.

  • CONFIG_ENV_URL: (Optional if .env provided) Direct URL of .env file posted on gist.github.com
  • CONFIG_JSON_URL: (Optional if config.json provided) Direct URL of config.json file posted on gist.github.com

Note

CONFIG_JSON_URL & CONFIG_ENV_URL will overwrite the existing local files if provided.


🗄 Deploy Guide

  • Only Deployable on Workflows
  • Soon Add for Heroku & VPS Users

Prerequisites:

  • Setup config.json and .env
  • Send a Dummy Message on the Channel (say 'test') you want to Setup Status and Retrieve the message id of it.

Procedure:

  • Step 1: Fork & Star the Repo
  • Step 2: Set Variables in Secrets in Settings Tab

    Available Variables: API_ID, API_HASH, PYRO_SESSION, CONFIG_ENV_URL, CONFIG_JSON_URL

  • Step 3: Enable Actions -> Select Workflow -> Run Workflow

Advanced MLTB Status:

Set the Code in the Required File wserver.py at the Last Path : ./web/wserver.py

from time import sleep, time
from psutil import boot_time, disk_usage, net_io_counters
from subprocess import check_output
from os import path as ospath

botStartTime = time()
if ospath.exists('.git'):
    commit_date = check_output(["git log -1 --date=format:'%y/%m/%d %H:%M' --pretty=format:'%cd'"], shell=True).decode()
else:
    commit_date = 'No UPSTREAM_REPO'

@app.route('/status', methods=['GET'])
def status():
    bot_uptime = time() - botStartTime
    uptime = time() - boot_time()
    sent = net_io_counters().bytes_sent
    recv = net_io_counters().bytes_recv
    return {
        'commit_date': commit_date,
        'uptime': uptime,
        'on_time': bot_uptime,
        'free_disk': disk_usage('.').free,
        'total_disk': disk_usage('.').total,
        'network': {
            'sent': sent,
            'recv': recv,
        },
    }

♻️ Cron Job Workflow:

  • Format for Tg Message Edit/Update Interval
    • */5 * * * *: Update Every 5mins Interval

      Due to Github Runner, Working Time Varies from 5min to more..

    • 0 */2 * * *: Update Every 2hrs Interval

ℹ️ Credits:

  • SilentDemonSD (Developer)

📚 References:

  • Based on xditya/BotStatus & junedkh/mirror-bot-status
  • Written in PyroFork Framework (Extended Pyrogram)

About

A Simple Script to Pretify All your Bots for your Channel in One Status..

Topics

Resources

License

Stars

Watchers

Forks

Languages