A Telegram bot that automatically removes inactive users from groups based on their last message activity.
- Automatically remove inactive users from a Telegram group
- Track user activity based on messages
- Configurable time periods (seconds, minutes, hours, days)
- Admin-only commands with permission checks
- Confirmation before kicking users
- Ignores admins and other bots
/start
- Start the bot and see welcome message/help
- Show help information and available commands/kickinactive [time]
- Remove inactive users based on specified time period- Examples:
/kickinactive 7d
,/kickinactive 24h
,/kickinactive 30m
- Examples:
- Python 3.7+
- Pyrogram
- MongoDB (optional, can be configured to use SQLite)
- Clone this repository
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file based on.env.example
with your credentials:API_ID=your_api_id API_HASH=your_api_hash BOT_TOKEN=your_bot_token MONGO_URI=mongodb://localhost:27017/ DB_NAME=kickbot
- Run the bot:
python main.py
- Click the Deploy to Heroku button
- Fill in the required environment variables:
API_ID
: Your Telegram API ID from my.telegram.orgAPI_HASH
: Your Telegram API Hash from my.telegram.orgBOT_TOKEN
: Your Bot Token from @BotFatherMONGO_URI
: MongoDB connection URI (you can use MongoDB Atlas for free tier)DB_NAME
: MongoDB database name (default: kickbot)
- Click "Deploy App"
The bot requires the following permissions in Telegram groups:
- Ban Users (to remove inactive members)
Join our Telegram channel: AnnihilusOP
See the LICENSE file for details.