Block Telegram's new

Overview

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.

You might also like...
Send notification to your telegram group/channel/private whenever a new video is uploaded on a youtube channel!

YouTube Feeds Bot. Send notification to your telegram group/channel/private whenever a new video is uploaded on a youtube channel! Variables BOT_TOKEN

A Telegram Bot which will ask new Group Members to verify them by solving an emoji captcha.

Emoji-Captcha-Bot A Telegram Bot which will ask new Group Members to verify them by solving an emoji captcha. About API: Using api.abirhasan.wtf/captc

Twitter bot that finds new friends in Twitter.

PythonTwitterBot Twitter Bot Thats Find New Friends pip install textblob pip install tweepy pip install googletrans check requirements.txt file Env

Written in Python, freezed into stand-alone executable with PyInstaller. This app will make sure you stay in New World without getting kicked for inactivity.
Written in Python, freezed into stand-alone executable with PyInstaller. This app will make sure you stay in New World without getting kicked for inactivity.

New World - AFK Written in Python, freezed into stand-alone executable with PyInstaller. This app will make sure you stay in New World without getting

Acid's Utilities is a bot for my Discord server that alerts when I go live, welcomes new users, has some awesome games and so much more!

Acid's Utilities Acid's Utilities is a bot for my Discord server that alerts when I go live, welcomes new users, has some awesome games and so much mo

This is a crypto trading bot that scans the Binance Annoucements page for new coins, and places trades on Gateio
This is a crypto trading bot that scans the Binance Annoucements page for new coins, and places trades on Gateio

gateio-trading-bot-binance-announcements This Gateio x Binance cryptocurrency trading bot scans the Binance Announcements page and picks up on new coi

A new coin listing alert bot using Python, Flask, MongoDB, Telegram API and Binance API
A new coin listing alert bot using Python, Flask, MongoDB, Telegram API and Binance API

Bzzmans New Coin Listing Detection Bot Architecture About Project Work in progress. This bot basically gets new coin listings from Binance using Binan

A mass creator for Discord's new channel threads.

discord-thread-flooder A mass creator for Discord's new channel threads. (obv created by https://github.com/imvast) Warning: this may lag ur pc if u h

Releases(0.1.4)
  • 0.1.4(Dec 9, 2021)

    Full Changelog: https://github.com/sam01101/TelegramChannelBlockerBot/compare/0.1.3...0.1.4

    Improvement

    • [fix] More exception added to prevent log spamming
    • [fix] Moved admin checking to top of function to prevent user calling unwanted APIs
    • [fix] Fix identifier typo
    • [fix] Fix mention mis-offset
    • [fix] Fix resolve peer error in get_channel_id
    • [fix] Fixed exceptions
    • [typo] Fixed logging typo
    • [improve] Function rename & Removed unnecessary Optional field
    Source code(tar.gz)
    Source code(zip)
  • 0.1.3(Dec 8, 2021)

    Full Changelog: https://github.com/sam01101/TelegramChannelBlockerBot/compare/0.1.1...0.1.3

    Why jumped to 0.1.3 and skipped 0.1.2? These two version are so close (Only 1 commit diff) so 0.1.2 are ignored

    What is new

    • [update] Update dep pyrogram to 1.2.19
    • [typo] Improve logging message
    • [fix] Request looping when missing permission(s)
    • [refactor] Refactor whole code for cleaner reading
    • [add] Added sql scripts
    • [enchant] Linked group ID will be cached for 5 minutes each time
    • [enchant] Channel ban improvement
    • [add] Added whitelist function
    • [add] Added command /stat, /is, /cwl, /crm, /start and `/help
    • [fix] Fix debug logging spamming of unbanning channels
    • [fix] Fix missing exception at message_handler
    • [fix] Removed utf-16 encoding that cause error
    • [fix] Fixed command name unable to call problem
    • [fix] Fixed command name unable to call problem
    • [fix] Fixed log spamming with invalid username

    New feature

    • Whitelist
    • Statistics (For counting banned channel)

    New commands

    • start
    • help
    • stat
    • is
    • cwl
    • crm
    Source code(tar.gz)
    Source code(zip)
  • 0.1.1(Dec 8, 2021)

    Full Changelog: https://github.com/sam01101/TelegramChannelBlockerBot/compare/0.1.0...0.1.1

    • [improve] Remove using get_chat * Note: I’ve noticed that it’s getting huge rate limit when using get_chat, hope this checking won’t be cracked.
    • [fix] Fix wrong exception attribute
    • [fix] Fixed CHAT_ADMIN_REQUIRED error spamming
    • [feat] Added banned message will show up in debug logging
    • [fix] Ignore nicked admin sending message to be deleted
    • [fix] Fix message will also delete linked channel
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Dec 8, 2021)

OpenQuake's Engine for Seismic Hazard and Risk Analysis

OpenQuake Engine The OpenQuake Engine is an open source application that allows users to compute seismic hazard and seismic risk of earthquakes on a g

Global Earthquake Model 281 Dec 21, 2022
Api REST para gerenciamento de cashback.

Documentação API para gerenciamento de cashback - MaisTODOS Features Em construção... Tecnologias utilizadas Back end Python 3.8.10 Django REST Framew

Alinne Grazielle 2 Jan 22, 2022
Facebook fishing on telegram bot

Facebook-fishing Facebook fishing on telegram bot تثبيت الاداة pkg update -y pkg upgrade -y pkg install git -y pkg install python -y git clone https:/

sadamalsharabi 7 Oct 18, 2022
Scrape Twitter for Tweets

Backers Thank you to all our backers! 🙏 [Become a backer] Sponsors Support this project by becoming a sponsor. Your logo will show up here with a lin

Ahmet Taspinar 2.2k Jan 02, 2023
Deploy your apps on any Cloud provider in just a few seconds

The simplest way to deploy your apps in the Cloud Deploy your apps on any Cloud providers in just a few seconds ⚡ Qovery Engine is an open-source abst

Qovery 1.9k Dec 26, 2022
A simple telegram voting bot based on the python-telegram-bot api.

A simple telegram voting bot based on the python-telegram-bot api. *To make it more easy to use, I might make a C++ code in the future so you don't ha

3 Sep 13, 2021
Binance leverage futures Hook

Simple binance futures Attention Just use leverage. The fee difference between futures and spot is not considered. For example, funding rate, etc. Onl

Adriance 26 Aug 27, 2022
Project for the discipline of Visual Data Analysis at EMAp FGV.

Analysis of the dissemination of fake news about COVID-19 on Twitter This project was the final work for the discipline of Visual Data Analysis of the

Giovani Valdrighi 2 Jan 17, 2022
DadBot 2.0 is an interactive bot that reflects the personality of a typical dad

DadBot 2.0 is an interactive bot that reflects the personality of a typical dad! You can start by running main while all directories are maintained as they are on this GitHub.

1 Dec 04, 2021
TwitterDataStreaming - Twitter data streaming using APIs

Twitter_Data_Streaming Twitter data streaming using APIs Use Case 1: Streaming r

Rita Kushwaha 1 Jan 21, 2022
A Telegram Message Manager Bot by @AbirHasan2005

Messages-Manager-Bot A Telegram Message Manager Bot by @AbirHasan2005. This Bot can delete specific type of messages from Group. I specially use for @

Abir Hasan 32 Nov 12, 2022
Google Sheets Python API

Google Spreadsheets Python API v4 Simple interface for working with Google Sheets. Features: Open a spreadsheet by title, key or url. Read, write, and

Anton Burnashev 6.2k Dec 30, 2022
GitHub Actions Docker training

GitHub-Actions-Docker-training Training exercise repository for GitHub Actions using a docker base. This repository should be cloned and used for trai

GitHub School 1 Jan 21, 2022
UniHub API is my solution to bringing students and their universities closer

🎓 UniHub API UniHub API is my solution to bringing students and their universities closer... By joining UniHub, students will be able to join their r

Abdelbaki Boukerche 5 Nov 21, 2021
Telegram Bot to store Posts and Documents and it can Access by Special Links.

File-sharing-Bot Telegram Bot to store Posts and Documents and it can Access by Special Links. I Guess This Will Be Usefull For Many People..... 😇 .

Code X Botz 1.2k Jan 08, 2023
DankMemer-Farmer - Autofarm Self-Bot for Discord bot Named Dankmemer.

DankMemer-Farmer Autofarm Self-Bot for Discord bot Named Dankmemer. Warning We are not responsible if you got banned, since "self-bots" outside of the

Mole 16 Dec 14, 2022
A Python library for the Docker Engine API

Docker SDK for Python A Python library for the Docker Engine API. It lets you do anything the docker command does, but from within Python apps – run c

Docker 6.1k Jan 03, 2023
Kevin L. 3 Jul 14, 2022
Anchor Protocol Script that can save you from being liquidated!

Why My day job requires a fairly good amount of automation from time to time. Besides, I do like computers to work on what I cannot while I'm sleeping

126 Oct 16, 2022
A Telegram AntiChannel bot to ban users who using channel to send message in group

Anti-Channel-bot A Telegram AntiChannel bot to ban users who using channel to send message in group. BOT LINK: Features: Automatic ban Whitelist Unban

Jigar varma 36 Oct 21, 2022