Skip to content

PbxBad/Banall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Telegram Mass Action Bot (Node.js)

Advanced Telegram bot built with Node.js and Telegraf for performing mass actions in groups.

Node.js Telegraf License

✨ Features

  • 🚫 BanAll - Ban all group members
  • βœ… UnbanAll - Unban all banned members
  • πŸ‘’ KickAll - Kick all members from group
  • πŸ”‡ MuteAll - Mute all members instantly
  • πŸ”Š UnmuteAll - Unmute all members
  • πŸ“Š Stats - Get detailed group statistics
  • πŸ›‘οΈ Admin Protection - Automatically excludes admins
  • ⚑ Fast & Efficient - Optimized performance
  • 🎯 Error Handling - Robust error management

πŸ“‹ Requirements

  • Node.js 18 or higher
  • Telegram Bot Token (from @BotFather)
  • MongoDB (optional)

πŸš€ Quick Start

1. Clone Repository

git clone https://github.com/PbxBad/Banall
cd Banall

2. Install Dependencies

npm install

3. Configure Environment

Create a .env file:

BOT_TOKEN=your_bot_token_here
OWNER_ID=your_telegram_user_id
MONGODB_URI=mongodb://localhost:27017/telegram-bot
BOT_USERNAME=YourBotUsername

4. Run the Bot

Development:

npm run dev

Production:

npm start

πŸ“ Commands

Command Description Admin Only
/start Start the bot & show welcome No
/help Show help message No
/stats Get group statistics No
/banall Ban all members Yes
/unbanall Unban all members Yes
/kickall Kick all members Yes
/muteall Mute all members Yes
/unmuteall Unmute all members Yes

πŸ› οΈ Installation

Local Setup

# Clone repository
git clone https://github.com/PbxBad/Banall

# Navigate to directory
Banall

# Install dependencies
npm install

# Create .env file
cp .env.example .env

# Edit .env with your credentials
nano .env

# Start bot
npm start

Docker Setup

# Build Docker image
docker build -t telegram-bot .

# Run container
docker run -d --env-file .env telegram-bot

Heroku Deployment

Deploy

# Login to Heroku
heroku login

# Create new app
heroku create your-bot-name

# Set environment variables
heroku config:set BOT_TOKEN=your_token
heroku config:set OWNER_ID=your_id

# Deploy
git push heroku main

πŸ”§ Configuration

Environment Variables

# Required
BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
OWNER_ID=123456789

# Optional
MONGODB_URI=mongodb://localhost:27017/bot
BOT_USERNAME=YourBot
LOG_LEVEL=info

Permissions Required

The bot needs these admin permissions:

  • βœ… Delete messages
  • βœ… Ban users
  • βœ… Restrict members
  • βœ… Invite users

πŸ“š API Documentation

Bot Methods

// Check if user is admin
await isAdmin(ctx)

// Check if bot is admin
await isBotAdmin(ctx)

// Ban user
await ctx.telegram.banChatMember(chatId, userId)

// Mute user
await ctx.telegram.restrictChatMember(chatId, userId, {
    can_send_messages: false
})

🎯 Use Cases

  • Group Management - Manage large groups efficiently
  • Moderation - Quick mass actions for raids/spam
  • Administration - Bulk user management
  • Testing - Test bot features in groups

⚠️ Important Notes

  1. Telegram Limits: Due to API limitations, some features work differently:

    • BanAll: May require members to send messages first
    • Large groups: Pagination required for 10k+ members
  2. Permissions: Bot must be admin with appropriate permissions

  3. Rate Limits: Telegram enforces rate limits on mass actions

πŸ” Security

  • Never share your bot token
  • Use environment variables
  • Keep dependencies updated
  • Validate user permissions
  • Log all actions

πŸ› Troubleshooting

Bot not responding?

# Check if bot is running
pm2 list

# Check logs
npm run logs

# Restart bot
pm2 restart bot

Permission errors?

  • Ensure bot is admin
  • Check bot has ban/mute permissions
  • Verify user is admin

πŸ“Š Statistics

Total Users: 1000+
Active Groups: 50+
Commands Executed: 10,000+
Uptime: 99.9%

🀝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open Pull Request

πŸ“„ License

This project is licensed under the MIT License - see LICENSE file.

πŸ‘¨β€πŸ’» Developer

πŸ“ž Support

πŸ™ Credits

  • Telegraf - Telegram bot framework
  • Node.js - JavaScript runtime
  • All contributors and supporters

πŸ“ˆ Roadmap

  • Add database support
  • Implement user warnings
  • Add custom commands
  • Anti-spam features
  • Multi-language support
  • Web dashboard
  • Analytics system

⭐ Star this repo if you found it useful!

Made with ❀️ by BadMunda

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published