Telegram AntiSpam Bot

Moderação automática de grupos — detecta e bane spammers em tempo real, sem intervenção humana.

Python 3.8+ Telethon MTProto AGPL-3.0 Anti-Spam Telegram Bot

O que faz

Bot para Telegram que monitora mensagens em grupos em tempo real. Ao detectar padrões típicos de spam, apaga a mensagem e bane o usuário permanentemente — tudo de forma automática.

  • 🗑️ Apaga a mensagem imediatamente
  • 🔨 Bane o usuário do grupo permanentemente
  • 🔄 Reinicia automaticamente em caso de falha

Pré-requisitos

  • Python 3.8+
  • Credenciais da API do Telegram
  • Token de bot via @BotFather
  • Bot com permissão de administrador no grupo (banir membros + apagar mensagens)

Instalação

bash
$ git clone https://github.com/VictorGabriel7Dev/telegram-antispam-bot.git
$ cd telegram-antispam-bot
$ pip install telethon
# edite run.py com suas credenciais
$ python run.py

Configuração

Edite as variáveis no dicionário textos dentro de run.py:

Variável Descrição
bot_api API ID de my.telegram.org
bot_hash API Hash de my.telegram.org
bot_sessao Caminho para o arquivo .session
bot_token Token do @BotFather
Após preencher as credenciais, adicione o bot ao grupo e conceda permissão de administrador com as capacidades de banir membros e apagar mensagens.
English

What it does

Telegram bot that monitors group messages in real time. Upon detecting typical spam patterns, it deletes the message and permanently bans the user — fully automatically.

  • 🗑️ Deletes the message immediately
  • 🔨 Permanently bans the user from the group
  • 🔄 Auto-restarts on failure

Requirements

  • Python 3.8+
  • Telegram API credentials
  • Bot token via @BotFather
  • Bot must be a group administrator (ban members + delete messages)

Installation

bash
$ git clone https://github.com/VictorGabriel7Dev/telegram-antispam-bot.git
$ cd telegram-antispam-bot
$ pip install telethon
# edit run.py with your credentials
$ python run.py

Configuration

Edit the variables in the textos dictionary inside run.py:

Variable Description
bot_api API ID from my.telegram.org
bot_hash API Hash from my.telegram.org
bot_sessao Path to the .session file
bot_token Token from @BotFather
After filling in the credentials, add the bot to the group and grant administrator permission with the ability to ban members and delete messages.