Skip to content

realekansh/Fedbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑️ HyperFederation Appeals Bot

photo_2025-07-11_20-46-48

Open Source Love Maintenance GitHub Forks GitHub Stars Last commit Contributors License

A comprehensive Telegram bot designed to handle FedBan appeals and Fed Admin requests with an intuitive user interface and robust admin management system.

πŸ“‹ Features

  • Dual Appeal Types: Support for FedBan unban appeals and Fed Admin requests
  • Interactive Interface: User-friendly inline keyboards for seamless navigation
  • Database Management: SQLite database for persistent appeal storage
  • Admin Notifications: Real-time notifications to administrators
  • Status Tracking: Comprehensive appeal status management
  • Error Handling: Robust error handling and logging
  • Template Guidance: Built-in templates to help users write effective appeals

πŸš€ Installation

Prerequisites

  • Python 3.7+
  • pip package manager

Setup

  1. Install Packages
sudo apt update && sudo apt install -y git python3 python3-venv python3-pip && sudo apt install python3
  1. Clone the repository
git clone https://github.com/real-ekansh/Fedbot
cd Fedbot
  1. Install dependencies
pip install -r requirements.txt
  1. Create environment file snd Activate it
python -m venv venv 
source venv/bin/activate
  1. Configure environment variables (see Configuration section)

  2. Run the bot

python fedbot.py

βš™οΈ Configuration

Create a .env file in the project root with the following variables:

BOT_TOKEN=your_telegram_bot_token_here
ADMIN_ID=your_telegram_admin_user_id
DB_PATH=appeals.db (defualt path)

Environment Variables

Variable Description Required
BOT_TOKEN Telegram Bot API token from @BotFather βœ…
ADMIN_ID Telegram user ID of the administrator βœ…
DB_PATH Path to SQLite database file ❌ (default: appeals.db)

πŸ“Š Database Schema

The bot uses SQLite with the following table structure:

CREATE TABLE appeals (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    user_id INTEGER NOT NULL,
    username TEXT,
    appeal_type TEXT NOT NULL,
    appeal_text TEXT,
    status TEXT DEFAULT "pending",
    timestamp TEXT NOT NULL,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

πŸ€– Bot Commands

User Commands

Command Description
/start Welcome message and bot introduction
/appeal Start the appeal process with type selection

Admin Commands

Command Description
/pending View all pending appeals
/approve <appeal_id> Approve a specific appeal
/reject <appeal_id> Reject a specific appeal

πŸ“± Usage

For Users

  1. Start the bot: Send /start to receive a welcome message
  2. Submit an appeal: Send /appeal and select your appeal type:
    • πŸ”“ Fed Unban Appeal: For requesting removal of FedBan
    • πŸ‘‘ Fed Admin Request: For requesting Fed Admin status
  3. Write your appeal: Follow the provided template and guidelines
  4. Wait for review: Your appeal will be reviewed by an administrator

Appeal Templates

FedBan Unban Appeal

1. Why were you banned?
2. What have you learned from this experience?
3. Why should we unban you?
4. Any additional information?

Fed Admin Request

1. Why do you want to be an admin?
2. What experience do you have?
3. How will you help the community?
4. Any additional information?

For Administrators

  1. Monitor appeals: Receive real-time notifications for new appeals
  2. Review pending appeals: Use /pending to see all pending appeals
  3. Process appeals: Use /approve <id> or /reject <id> to process appeals

πŸ”§ Technical Details

Dependencies

python-telegram-bot>=13.0
python-dotenv>=0.19.0

File Structure

telegram-appeals-bot/
β”œβ”€β”€ bot.py              # Main bot application
β”œβ”€β”€ appeals.db          # SQLite database (auto-created)
β”œβ”€β”€ .env               # Environment variables
β”œβ”€β”€ .env.example       # Environment template
β”œβ”€β”€ requirements.txt   # Python dependencies
└── README.md         # This file

Logging

The bot implements comprehensive logging with the following levels:

  • INFO: General operational information
  • ERROR: Error conditions and exceptions
  • WARNING: Warning conditions

Logs include timestamps, logger names, and detailed error messages for debugging.

Error Handling

  • Configuration Validation: Validates required environment variables on startup
  • Database Error Handling: Graceful handling of SQLite connection issues
  • Telegram API Errors: Proper handling of Telegram API exceptions
  • User Input Validation: Validates user inputs and appeal types

πŸ›‘οΈ Security Features

  • Admin Access Control: Restricted admin commands to authorized users only
  • Input Sanitization: Proper handling of user inputs
  • Error Isolation: Prevents error propagation that could crash the bot
  • Database Security: Safe database operations with parameterized queries

🀝 Contributing

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

πŸ“ License

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

πŸ› Bug Reports

If you encounter any bugs or issues, please report them through the GitHub issues page with:

  • Detailed description of the issue
  • Steps to reproduce
  • Expected vs actual behavior
  • Log messages (if applicable)

πŸ“ž Support

For support and questions:

  • Create an issue on GitHub
  • Check the documentation
  • Review the logs for error messages
  • Contact on Telegram
  • Discussion in the official telegram chat [en]

πŸ‘¨πŸ»β€πŸ’Ό Credits


If you liked my Work please give my Project a Star ⭐

Made with ❀️ for the Telegram community

About

A Simple Telegram Bot which helps you to Managing Appeals for your Federation.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages