Giraffe Spam Crusher is a sophisticated Telegram bot designed for efficient spam detection and mitigation in channels and groups. It leverages state-of-the-art artificial intelligence to identify and neutralize spam content with high accuracy.
- Utilizes advanced natural language processing models from OpenAI or Anthropic for message analysis
- Implements user tracking mechanisms to optimize processing efficiency
- Provides configurable spam sensitivity thresholds
- Supports retrospective analysis of message history in existing groups
- Offers channel-specific targeting capabilities
- Generates comprehensive operational statistics
- New User Monitoring: Focuses analysis on messages from recent group joiners
- AI-Powered Analysis: Employs machine learning models for precise spam classification
- Flexible Configuration: Allows fine-tuning of detection parameters
- Proactive Mitigation: Executes automated spam removal or flagging based on analysis results
- Historical Processing: Capable of analyzing pre-existing group messages
- Selective Deployment: Operates exclusively within designated channels
-
Clone the repository:
git clone https://github.com/ailabhub/giraffe-spam-crasher.git cd giraffe-spam-crasher
-
Configure the bot by creating a
.env
file with the following parameters:TELEGRAM_BOT_TOKEN=your_bot_token OPENAI_API_KEY=your_openai_key ANTHROPIC_API_KEY=your_anthropic_key HISTORY=/root/result.json PROMPT=/root/prompt.txt MODEL=claude-3-5-sonnet-20240620 PROVIDER=anthropic SPAM_THRESHOLD=0.6 NEW_USER_THRESHOLD=1 WHITELIST_CHANNELS= LOG_LEVEL=info
-
On first launch, export the chat history to a file named results.json.
Ensure Docker and Docker Compose are installed on your system, then:
-
Initialize the bot:
docker-compose up -d
-
Monitor bot operations:
docker-compose logs -f bot
-
Terminate the bot:
docker-compose down
The bot can be configured using command-line flags or environment variables in the .env
file. Here are the available options:
-
HISTORY
: Path to the history file for identifying "old" users- Usage:
-history=/path/to/history.json
- Docker:
HISTORY=/root/result.json
- Usage:
-
PROMPT
: Path to the prompt text file- Usage:
-prompt=/path/to/prompt.txt
- Docker:
PROMPT=/root/prompt.txt
- Usage:
-
MODEL
: AI model to use (e.g., gpt-4 for OpenAI, claude-3-5-sonnet-20240620 for Anthropic)- Usage:
-model=claude-3-5-sonnet-20240620
- Docker:
MODEL=claude-3-5-sonnet-20240620
- Usage:
-
PROVIDER
: API provider (openai or anthropic)- Usage:
-provider=anthropic
- Docker:
PROVIDER=anthropic
- Usage:
-
SPAM_THRESHOLD
: Threshold for classifying a message as spam (0-1)- Usage:
-spam-threshold=0.6
- Docker:
SPAM_THRESHOLD=0.6
- Usage:
-
NEW_USER_THRESHOLD
: Number of messages after which a user is no longer considered new- Usage:
-new-user-threshold=1
- Docker:
NEW_USER_THRESHOLD=1
- Usage:
-
WHITELIST_CHANNELS
: Comma-separated list of whitelisted channel IDs- Usage:
-whitelist-channels=-1001098030726,-1001098030727
- Docker:
WHITELIST_CHANNELS=-1001098030726,-1001098030727
- Usage:
-
LOG_LEVEL
: Logging verbosity (debug, info, warn, error)- Usage:
-log-level=info
- Docker:
LOG_LEVEL=info
- Usage:
-
LOG_CHANNELS
: Comma-separated list of working chat ID and log channel ID pairs- Usage:
-log-channels=-1001098030726:-1001089898989,-1001098030727:-1001089898990
- Docker:
LOG_CHANNELS=-1001098030726:-1001089898989,-1001098030727:-1001089898990
- Usage:
When using Docker, these configurations can be set in the .env
file or passed as environment variables to the Docker container.
Giraffe Spam Crusher is composed of three primary modules:
ai
: Handles AI model interactionsbot
: Manages Telegram API communicationshistory
: Facilitates message data persistence
We welcome contributions to enhance Giraffe Spam Crusher. Please submit issues or pull requests via GitHub for proposed improvements or bug fixes.
Giraffe Spam Crusher is distributed under the MIT License. This permits free use, modification, and distribution of the bot, provided that the original copyright notice and license text are preserved within the codebase.
MIT License
Copyright (c) 2024 AILabHub
[Full license text]