Skip to content

prabeshAryal/Tg-Many-To-One

Repository files navigation

Telegram to Telegram Forwarder

A userbot to scrap your Favourite Telegram chats, groups or channels to your single specific Telegram Chat(Channel/Group also).

Deploy Develop on Okteto

Table of Contents

  1. Introduction
    1. About User Bot
    2. Working Principle
  2. Knowing All Variables
    1. API Codes
    2. Channel ID
    3. Other Notable Variables
  3. Requirements
    1. Python
      1. PIPs
  4. Deploy
  5. License

Read this throughly before deploying the bot:

What is this bot about?

This bot is make specifically for one purpose. That is to monitor many Telegram Channels and send to you in one Telegram chat of any form removing hashtags and mentions.

How does this bot work?

This bot works in various steps as :

  • It listens for new posts in your Telegram Channels.
  • Tries to clean captions (beta stage).
  • Send Caption, Media or both.
  • Also, it sends an empty sticker to distinguish between posts.

Get Variables

API_ID and API_Hash

Getting Channel ID

Private Channels/Groups

  • Send a Message to channel and copy link of that Telegram Channel Post.
  • Then your link looks like this : https://t.me/c/1617181920/369
  • Note that long number of 10 digits and add -100 in beginning and it must look like: -1001617181920
  • This is your Channel ID (including - sign.)

Public Channels/Person/Groups

  • Send a Message /info @ChannelName to GroupHelpBot and copy link of that Telegram Channel Post.

Note : For pivate chats with no username, mention the person in group or send /info command from that respective account to GroupHelpBot .

Other Variables

There are some other variables which you need to note about.

Session String

  • Generate Session String in a file using the code below:
from telethon.sessions import StringSession

api_id = 0000
api_hash = 'sdfghklasaaddadadasd'

with TelegramClient(StringSession(), api_id, api_hash) as client:
    session= client.session.save()
    print(session)
    r = open("new_session_file.session","w")
    r.write(session)
    r.close()
	

Variables as configured in bot.

  • BOT_API_TOKEN - Enter Bot API Token which you get from Botfather in Telegram.
  • from_ids - Enter Channel ID of your Telegram Channel from where you want to watch posts. Can be multiple channels, groups, chats in list form separated by comma.
  • to_id - Enter a Chat ID of where you'll get all posts/messages.
  • every_post_caption - Enter a Caption for every posts you sent to Telegram in image. Can be your channel username or some emoji.

Required Softwares and Languages

Python

Download Python From here :

While installing, tick install path / environment variables whatever is given

Python Snippets

  • Install required python modules using commands below:
  • pip install telethon
  • Install all above modules using :
  • pip install -r requirements.txt

Deploying the bot

Deploying Locally

  • Install Python, PIPs using above methods
  • Download all files in this repo.
  • Replace variables at the top of bot.py file with your ones, removing os.environ.get('name') commands.

Type any one of the following command on terminal to run bot:

  • py bot.py
  • python bot.py
  • python3 bot.py

Deploying to HEROKU :

Press the button below or at the top of this readme and insert necessary environment variables and you're done. Deploy

##Develop on Okteto: Press the button below or at the top of this readme and insert necessary environment variables and you're done. Develop on Okteto

License

Distributed Under GPL or MIT License by @PrabeshAryalNP on social or @PrabeshAryal on code sites.

About

A Telegram Userbot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published