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)

Python 3 tools for interacting with Notion API

NotionDB Python 3 tools for interacting with Notion API: API client Relational database wrapper Installation pip install notiondb API client from noti

Viet Hoang 14 Nov 24, 2022
This is a music bot for discord written in python

this is a music bot for discord written in python, it is designed for educational use ONLY, I do not take any responsibility for uses outside of educational use

5 Dec 24, 2021
Create Multiple CF entry for multiple websites

AWS-CloudFront Problem: Deploy multiple CloudFront for account with multiple domains. Functionality: Running this script in loop and deploy CloudFront

Giten Mitra 5 Nov 18, 2022
An advanced telegram country information finder bot.

Country-Info-Bot-V2 An advanced telegram country information finder bot Made with Python3 (C) @FayasNoushad Copyright permission under MIT License Lic

Fayas Noushad 16 Nov 12, 2022
An information scroller Twitter trends, news, weather for raspberry pi and Pimoroni Unicorn Hat Mini and Scroll Phat HD.

uticker An information scroller Twitter trends, news, weather for raspberry pi and Pimoroni Unicorn Hat Mini and Scroll Phat HD. Features include: Twi

Tansu Şenyurt 1 Nov 28, 2021
Support for Competitive Coding badges to add in Github readme or portfolio websites.

Support for Competitive Coding badges to add in Github readme or portfolio websites.

Akshat Aggarwal 2 Feb 14, 2022
A lightweight Python wrapper for the IG Markets API

trading_ig A lightweight Python wrapper for the IG Markets API. Simplifies access to the IG REST and Streaming APIs with a live or demo account. What

IG Python 247 Dec 08, 2022
This repository contains free labs for setting up an entire workflow and DevOps environment from a real-world perspective in AWS

DevOps-The-Hard-Way-AWS This tutorial contains a full, real-world solution for setting up an environment that is using DevOps technologies and practic

Mike Levan 1.6k Jan 05, 2023
Spotify Top Lists - get the current top lists of a user from the Spotify API and display them in a Flask app

Spotify Top Lists This is a simple script that will get the current top lists of a user from the Spotify API and display them in a Flask app. Requirem

Yasin 0 Oct 16, 2022
A Telegram Bot which notifies the user when a vaccine is available on CoWin Platform.

Cowin Vaccine Availability Notifier Telegram Bot A bot that notifies the available vaccines at given district in realtime. Introduction • Requirements

Arham Shah 7 Jul 31, 2021
A Bot Upload file|video To Telegram using given Links.

A Bot Upload file|video To Telegram using given Links.

Hash Minner 19 Jan 02, 2023
The aim is to contain multiple models for materials discovery under a common interface

Aviary The aviary contains: - roost, - wren, cgcnn. The aim is to contain multiple models for materials discovery under a common interface Environment

Rhys Goodall 20 Jan 06, 2023
Live Coding - Mensageria na AWS com Amazon SNS e Amazon SQS

Live Coding - Mensageria na AWS com Amazon SNS e Amazon SQS Repositório para o Live Coding do dia 08/12/2021 Serviços utilizados Amazon SNS Amazon SQS

Cassiano Ricardo de Oliveira Peres 3 Mar 01, 2022
A simple script that can be used to track real time that user was online in telegram

TG_OnlineTracker A simple script that can be used to track real time that user was online in telegram Join @DaisySupport_Official 🎵 for help 🏃‍♂️ Ea

Inuka Asith 15 Oct 23, 2022
Discord Bot Personnal Server - Ha-Neul

Haneul Bot, it's a discord for help me on my personnal discord, she do a lot of boring and repetitive stain. You can use on your own server if you want, you just need to find a host for the programm

Maxvyr 1 Feb 03, 2022
Wechat based auto reply with pyautogui

Python-微信 自动回复 练手~ 一直想做个给微信发个消息,就可以跑Python程序,并将结果发送给我的东西,之前看了 B站@不高兴就喝水 的视频,终于有了灵感~ 使用的是模拟点击方案,请求期间是不能操作了。 库 pyautogui 用于模拟鼠标键盘操作和定位操作位置 pyperclip 剪贴板

Vito Song 1 Oct 22, 2022
Connects to a local SenseCap M1 Helium Hotspot and pulls API Data.

sensecap_api_checker_HELIUM Connects to a local SenseCap M1 Helium Hotspot and pulls API Data.

Lorentz Factr 1 Nov 03, 2021
discord bot made in discord.py

udeline discord bot made in discord.py, which's main features include: general use server moderation fun commands other cool commands dependencies dis

1 Feb 08, 2022
100d002 - Simple program to calculate the tip amount and split the bill between all guests

Day 2 - Tip Calculator Simple program to calculate the tip amount and split the

Andre Schickhoff 1 Jan 24, 2022
A discord bot providing notifications of player activity on a minecraft server.

tos-alert A discord bot providing notifications of player activity on a minecraft server. Setup By default the app does not launch and will crash with

1 Jul 22, 2022