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)

股票量化

StockQuant Gary-Hertel 请勿提交issue!可以加入交流群与其他朋友一起自学交流,加微信mzjimmy 一、配置文件的设置 启动框架需要先导入必要的模块,并且载入一次配置文件! 配置文件是一个json格式的文件config.json,在docs文件夹中有模板

218 Dec 25, 2022
An alternative launcher for Lunar Client which is aimed at portability and functionality.

Portaluna An alternative launcher for Lunar Client which is aimed at portability and functionality. Features Portable. Lightweight. Functional. Note:

4 Mar 05, 2022
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
Automatically Edits Videos and Uploads to Tiktok with 1 line of code.

TiktokAutoUploader - Open to code contributions Automatically Edits Videos and Uploads to Tiktok with 1 line of code. Setup pip install -r requirement

Michael Peres 199 Dec 27, 2022
5 Oct 19, 2022
Riffdog Terraform scanner - finding 'things' in the Real World (aka AWS) which Terraform didn't put there.

riffdog Riffdog Terraform / Reality scanner - finding 'things' in the Real World which Terraform didn't put there. This project works by firstly loadi

Riffdog 4 Mar 23, 2020
eBay Scraper Homework 3 With Python

eBay Scraper Homework 3 Description of Code My ebay-dl.py file is programmed with python to download 6 key pieces of information - name, if there are

1 Nov 10, 2021
Aula-API - a school system widely used in Denmark, as you can see and read about in the python file

Information : Hello, thank you for reading this first of all. This is a Aula-API

Binary.club 2 May 28, 2022
Discord spam bots with multiple account support and more

Discord spam bots with multiple account support and more. PLEASE READ EVERYTHING BEFORE WRITING AN ISSUE!! Server Messages Text Image Dm Messages Text

Mr. Nobody 6 Sep 14, 2022
:lock: Python 2.7/3.X client for HashiCorp Vault

hvac HashiCorp Vault API client for Python 3.x Tested against the latest release, HEAD ref, and 3 previous minor versions (counting back from the late

hvac 1k Dec 29, 2022
Python API Client for Close

Close API A convenient Python wrapper for the Close API. API docs: http://developer.close.com Support: Close 56 Nov 30, 2022

A file-based quote bot written in Python

Let's Write a Python Quote Bot! This repository will get you started with building a quote bot in Python. It's meant to be used along with the Learnin

Florent 1 Dec 17, 2021
AuthGG is a Python library for dealing with Auth.gg apis

AuthGG AuthGG is a Python library for dealing with Auth.gg apis Installation Use the package manager pip to install requests Add the auth.py file in y

ExtremeDev 1 Dec 20, 2021
Kanata Bot - a modular bot running on python3 with anime theme and have a lot features

Kanata Bot Kanata Bot is a modular bot running on python3 with anime theme and have a lot features. Easiest Way To Deploy On Heroku This Bot is Create

Rikka-Chan 2 Jan 16, 2022
Stack overflow search API

Stack overflow search API

Vikash Karodiya 1 Nov 15, 2021
Subtitle Translater

Subtitle Translater

OshadhaVimukthi 2 Nov 29, 2021
An open-source Discord Bot Project based on programming!

An open-source Discord Bot Project based on programming!

Vladimer Moore 2 Aug 22, 2022
Python script using Twitter API to change user banner to see 100DaysOfCode process.

100DaysOfCode - Automatic Banners 👩‍💻 Adds a number to your twitter banner indicating the number of days you have in the #100DaysOfCode challenge Se

Ingrid Echeverri 10 Jul 06, 2022
Playing around with the slack api for learning purposes

SlackBotTest Playing around with the slack api for learning purposes and getting people to contribute Reason for this Project: Bots are very versatile

1 Nov 24, 2021
A Telegram Video Watermark Adder Bot

Watermark-Bot A Telegram Video Watermark Adder Bot by @VideosWaterMarkRobot Features: Save Custom Watermark Image. Auto Resize Watermark According to

5 Jun 17, 2022