Git Product home page Git Product logo

tgbotstatus's Introduction

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)

tgbotstatus's People

Contributors

silentdemonsd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tgbotstatus's Issues

Request

  1. Multi-Language Support : Translate the Whole interface and messages into multiple languages.

Example: If A Bot Owner Enable Translate Option Then Under Stats Massage A New Button Will Added And When Any User Want To read Massage On Another Laguage Then just have to click on translate button then automatically user will redirect to bot and he got option to choose language after selected language the massage will apear on that language.
2. Deploy on heroku

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.