TgBotStatus
TgBotStatus copied to clipboard
A Simple Script to Pretify All your Bots for your Channel in One Status..
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 HereHEADER_MSG: Put Header Msg for 1st Line.Default: Telegram Bot Status :
TIME_ZONE: Time Zone for Sync with your Local TimeDefault: Asia/Kolkata
BOT_TOKEN: (Optional) Only Required ifMSG_BUTTONSis 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 ]
- How to Use ?
config.json File SetUp :
-
Sections are Divided into 2 Parts:
- Bots Details:
bot1: Indentifier Name (Can be Anything But Unique for Every Bot)
Variable Value Required base_url_of_botIf MLTB bot, give Base URL of it. (Optional) hostHost name where you have deployed *Required bot_unameBot Username without @ *Required - Chat Details:
chat1: Indentifier Name (Can be Anything But Unique for Every Bot)
Variable Value Required chat_idchat id of the Target Channel or Group *Required message_idmessage id of the Message to Edit. If link is https://t.me/cha_uname/123 Here, 123 is the Message ID *Required - Bots Details:
đǧ 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.envfile posted on gist.github.comCONFIG_JSON_URL: (Optional if config.json provided) Direct URL ofconfig.jsonfile posted on gist.github.com
[!NOTE]
CONFIG_JSON_URL&CONFIG_ENV_URLwill overwrite the existing local files if provided.
đ Deploy Guide
- Only Deployable on Workflows
- Soon Add for Heroku & VPS Users
Prerequisites:
- Setup
config.jsonand.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 IntervalDue 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)