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)

Owner
Ah!
null
🔪 Block replies to viral tweets from users getting paid to promote useless products

This Tweet Took Off Ublock Origin filter list targeting long reply chains posted by twitter users who get paid to promote random products on viral twe

Xetera 12 Jan 14, 2022
Scheduled Block Checker for Cardano Stakepool Operators

ScheduledBlocks Scheduled Block Checker for Cardano Stakepool Operators Lightweight and Portable Scheduled Blocks Checker for Current Epoch. No cardan

SNAKE (Cardano Stakepool) 4 Oct 18, 2022
Scheduled Block Checker for Cardano Stakepool Operators

ScheduledBlocks Scheduled Block Checker for Cardano Stakepool Operators Lightweight and Portable Scheduled Blocks Checker for Current Epoch. No cardan

SNAKE (Cardano Stakepool) 4 Oct 18, 2022
Filters to block and remove copycat-websites from DuckDuckGo and Google

uBlock Origin - Shitty Copy-Paste websites filter Filter for uBlock origin to remove spam-website results from DuckDuckGo and Google that just blatant

null 99 Dec 15, 2022
Filters to block and remove copycat-websites from DuckDuckGo and Google. Specific to dev websites like StackOverflow or GitHub.

uBlock-Origin-dev-filter Filters to block and remove copycat-websites from DuckDuckGo and Google. Specific to dev websites like StackOverflow or GitHu

null 1.7k Dec 30, 2022
Some Discord bot block bad words, with this simple hacking tool you will be able to bypass blacklisted words

DISCORD-BAD-WORD-BYPASS-2022 DISCORD BLACKLISTED WORDS HACKING/BYPASS (EDUCATIONAL PURPOSES ONLY) bypass discord blacklisted words. Description Some D

null 6 Nov 20, 2022
MashaRobot : New Generation Telegram Group Manager Bot (🔸Fast 🔸Python🔸Pyrogram 🔸Telethon 🔸Mongo db )

MashaRobot Me On Telegram ✨ MASHA ✨ This is just a demo bot.. Don't try to add to your group.. Create your own bot How To Host The easiest way to depl

Mr Dark Prince 40 Oct 9, 2022
Adds a new git subcommand named "ranch".

Git Ranch This script adds ranch, a new subcommand for git that makes it easier to order 1 Gallon of Kraft Ranch Salad Dressing from Amazon. Installat

Austin T Schaffer 8 Jul 6, 2022
A Script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag.

Channel Auto Message Forward A script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag

null 16 Oct 21, 2022
One of the best Telegram renamer bot with many new features

Renamer-Bot I think this repo gonna become one of the best renamer open source ?? . Please Give a ⭐ if you like this repo and also try following me fo

Ns Bots 97 Jan 6, 2023