A Telegram bot designed to help moderate and manage the JsWeekdays community by detecting and handling spam messages. This bot uses the tg-spam service for spam detection.
- Automated spam detection using tg-spam
- Automatic updates of spam detection samples
- Telegram group moderation
- Admin notifications for suspicious messages
- Real-time message processing
- Docker containerization for easy deployment
Before running the bot, make sure you have:
- Docker and Docker Compose installed
- A Telegram Bot Token (obtainable from @BotFather)
- An OpenAI API key
- Admin access to your Telegram group
The following environment variables are required:
TELEGRAM_TOKEN
: Your Telegram bot tokenTELEGRAM_GROUP
: ID of the Telegram group to moderateOPENAI_TOKEN
: Your OpenAI API keyADMIN_GROUP
: ID of the Telegram group for admin notifications
The project uses Docker Compose with three services:
tg-spam
: Main spam detection servicetg-spam-updater
: Service that keeps spam samples up to datewatchtower
: Automatic container updates (checks every 30 seconds)
The following directories are used for persistent storage:
./data
: General data directory./log
: Log files./tg-spam-samples
: Spam detection samples./tg-spam-dynamic
: Dynamic spam detection data
-
Clone the repository:
git clone https://github.com/your-username/not-a-function-bot.git cd not-a-function-bot
-
Create necessary directories:
mkdir -p data log tg-spam-samples tg-spam-dynamic
-
Set up your environment variables:
cp .env.example .env # Edit .env with your actual values
-
Start the services:
docker-compose up -d
- Logging enabled with JSON format
- Max log size: 10MB with 5 rotations
- Debug mode enabled
- No spam reply mode enabled
- Updates spam samples from the official repository
- Samples stored in
/samples
directory
- Automatically updates containers
- Checks for updates every 30 seconds
Logs are stored in the ./log
directory with a maximum size of 5MB per file. You can view the logs using:
docker-compose logs -f tg-spam
Contributions are welcome! Please feel free to submit a Pull Request.
For support, please join our Telegram group or open an issue in this repository.
- tg-spam for spam detection
- JsWeekdays community
- OpenAI for providing the AI capabilities
- Telegram Bot API