Skip to content

aleksfolt/Waffle-Moderator

Repository files navigation

Let's Start

Welcome to the "Waffle Moderator" project! 🚀


A Note from the Developer

Before diving into the details, I’d like to clarify that I’m not a professional web developer. I learned SQLAlchemy and Quart while creating this bot, so it may not be perfect. However, I’m proud to present one of the first fully functional Telegram moderation bots available on GitHub!


Features

  • Moderation tools such as Mute, Ban, Kick, and Reports (Warn is coming soon).
  • Management through an integrated website interface.
  • Additional features that are better discovered at runtime for security reasons.

Delpoy to your device

Repository Setup

Follow these steps to clone the repository and set up the environment:

  1. Clone the Repository:
    git clone https://github.com/aleksfolt/Waffle-Moderator.git
    cd Waffle-Moderator
    
  2. Create a Virtual Environment:
    # On Linux/macOS:
    python3 -m venv venv
    
    # On Windows:
    python -m venv venv
    
  3. Activate the Virtual Environment:
    # On Linux/macOS:
    source venv/bin/activate
    
    # On Windows:
    venv\Scripts\activate
    
  4. Install Dependencies:
    pip install -r requirements.txt
    

Telegram

  1. Create a Bot:

    • Go to BotFather on Telegram and create a new bot.
    • Copy the token provided by BotFather after creating the bot.
  2. Set the Webhook URL:

    • In BotFather, use the /setdomain command to set the webhook URL for your bot.
    • Choose your bot and provide your domain (e.g., https://yourdomain.com).
  3. Configure Your Bot:

    • Open the config.py file in the project.
    • Paste your bot token into the BOT_TOKEN variable.
    • Optionally, change the bots name by modifying the BOT_NAME variable.

Database Setup

To deploy the bot, you need to set up a PostgreSQL database. Follow these steps:

  1. Install PostgreSQL (if not already installed):
    # On Ubuntu/Debian:
    sudo apt update
    sudo apt install postgresql postgresql-contrib
    
    # On macOS (via Homebrew):
    brew install postgresql
    
    # On Windows:
    # Download and install PostgreSQL from https://www.postgresql.org/download/
    
  2. Start PostgreSQL Service:
    # On Ubuntu/Debian:
    sudo service postgresql start
    
    # On macOS:
    brew services start postgresql
    
  3. Create the Database and User:
    # Access the PostgreSQL shell as the postgres user:
    sudo -u postgres psql
    
    # Inside the PostgreSQL shell, run the following commands:
    CREATE DATABASE waffledb;
    CREATE USER waffle WITH PASSWORD 'FromSiberiaLove';
    GRANT ALL PRIVILEGES ON DATABASE waffledb TO waffle;
    
    # Exit the PostgreSQL shell:
    \q
    
  4. Check conetction:
    psql -h localhost -U waffle -d waffledb
    
  5. Optional Configuration: If you prefer to use different database credentials, update the following values in the config.py file:
    DATABASE_URL = (
        "postgresql+asyncpg://waffle:FromSiberiaLove@localhost:5432/waffledb"
    )
    

Start Bot

Well, everything is ready! Now let's launch the bot:

 # On Linux/MacOs
 python3 main.py
 
 # On Windows
 python main.py

Notes for Shindows Users

  • Filesystem Differences:

The bot may not work correctly on Windows due to differences in the filesystem and path handling. For the best experience, consider using a Linux-based environment or tools like WSL (Windows Subsystem for Linux).

  • Database Connection:

Ensure PostgreSQL is properly configured and accessible on Windows. Use the connection details specified in the config.py file


Alt

Releases

No releases published

Packages

No packages published

Languages