Telegram Channel Blocker Bot
Channel go away!
This bot is used to delete and ban message sent by channel
How this appears?
The reason this appears please see this contest hosted by Telegram
channels.sendAsPeers peers:Vector
chats:Vector
users:Vector
= channels.SendAsPeers;
...
---functions---
...
channels.getSendAs peer:InputPeer = channels.SendAsPeers;
In the contest, Telegram added few new APIs. One of them is channels.sendAsPeers
.
This API can send message as a channel peer.
This changes applied in both Development and Production server,
but in Production this behaves were limited. (Only channel admin can send as a channel peer)
Later (07-12-2021), Telegram released a new update that normal user can do the same thing, as they are owner of the channel peer.
So this bot is invented to solve this problem.
Currently, (07-12-2021) Telegram didn't add those APIs in the official Schema.
Install
Pre requirements:
- Python 3.8+ (pypy should also support, but not tested.)
This project uses poetry to install dependencies.
Please install poetry globally by using pip install poetry
$ poetry init
Using version ^X.X.X for loguru
Using version ^X.X.X for Pyrogram
Using version ^X.X.X for TgCrypto
...
Updating dependencies
Resolving dependencies...
Writing lock file
Package operations: 8 installs, 0 updates, 0 removals
• Installing async-lru (X.X.X)
• Installing colorama (X.X.X)
• Installing pyaes (X.X.X)
• Installing pysocks (X.X.X)
• Installing win32-setctime (X.X.X)
• Installing loguru (X.X.X)
• Installing pyrogram (X.X.X)
• Installing tgcrypto (X.X.X)
...
$
How to use
Rename config.ini.example
to config.ini
and edit the config
Simply run this script with python3 main.py
and add it to your group, it will automatically start working.
Important note: You have to TURN OFF privacy mode for your bot via @BotFather using /setprivacy
command
Note: You must give this bot permission to delete message and ban users.
Example bot
Running official bot: @Auto_Block_Channel_Bot
simply add in your group and give delete message
and ban
user permission and there you go!
Linked group will not affect the function
Contributing
Please follow Google Python Style Guide to write code.
Before submitting pull request, please make sure your code is able to run successfully.