Skip to content

afselk/tg-bots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Bots Documentation

1. Forwarding Bot

This script is a Telegram bot that forwards messages from specified channels to a target chat upon receiving the forward start command. It stops forwarding messages when the forward stop command is issued.

Features

  • Start forwarding messages from selected channels with the forward start command.
  • Stop forwarding messages with the forward stop command.
  • Monitor and forward messages from multiple specified Telegram channels.

Prerequisites

  1. Python 3.7 or higher
  2. Telethon library Install it using pip:
    pip install telethon
  3. Telegram API credentials Generate API credentials for your Telegram account. You can obtain these credentials by following the instructions at Telegram API Documentation.

Setup

  1. Clone or download this repository.
  2. Replace the placeholders in the script with your Telegram API credentials:
    • api_id
    • api_hash
  3. Specify the channels to monitor by adding their usernames or IDs to the monitored_channels list in the script.

Running the Bot

To run the bot:

  1. Directly Run in Terminal

    python3 your_script_name.py
  2. Run in Background Using nohup

    nohup python3 your_script_name.py > output.log 2>&1 &
    • This command ensures the bot keeps running even if the terminal is closed.
    • Logs will be saved in output.log.

Commands

  • Start Forwarding: Send forward start to the bot to enable message forwarding.
  • Stop Forwarding: Send forward stop to the bot to disable message forwarding.

Customization

  • Update the monitored_channels list in the script to include the channels you want to monitor.

Example

  • Monitored Channels: @infinityhedge, @shoalresearch, @wublockchainenglish

Notes

  • Ensure the bot has permission to read messages in the monitored channels.

2. Scheduled Messages Bot

This script is a Telegram bot that sends scheduled messages to a chat, simulating a live TV presenter style. The bot handles commands to start and stop the schedule.

Features

  • Start scheduled message broadcasting with the show start command.
  • Stop scheduled broadcasting with the show stop command.

Prerequisites

  1. Python 3.7 or higher
  2. Telethon library Install it using pip:
    pip install telethon
  3. Telegram API credentials Generate API credentials for your Telegram account. You can obtain these credentials by following the instructions at Telegram API Documentation.

Setup

  1. Clone or download this repository.
  2. Replace the placeholders in the script with your Telegram API credentials:
    • api_id
    • api_hash
  3. The script automatically handles chats where the show start command is received.

Running the Bot

To run the bot:

  1. Directly Run in Terminal

    python3 your_script_name.py
  2. Run in Background Using nohup

    nohup python3 your_script_name.py > output.log 2>&1 &
    • This command ensures the bot keeps running even if the terminal is closed.
    • Logs will be saved in output.log.

Commands

  • Start Schedule: Send show start to the bot to begin scheduled message broadcasting.
  • Stop Schedule: Send show stop to the bot to stop the broadcasting.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages