Welcome to the "Waffle Moderator" project! 🚀
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!
- 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.
Follow these steps to clone the repository and set up the environment:
- Clone the Repository:
git clone https://github.com/aleksfolt/Waffle-Moderator.git cd Waffle-Moderator
- Create a Virtual Environment:
# On Linux/macOS: python3 -m venv venv # On Windows: python -m venv venv
- Activate the Virtual Environment:
# On Linux/macOS: source venv/bin/activate # On Windows: venv\Scripts\activate
- Install Dependencies:
pip install -r requirements.txt
-
Create a Bot:
- Go to BotFather on Telegram and create a new bot.
- Copy the token provided by BotFather after creating the bot.
-
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
).
- In BotFather, use the
-
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.
- Open the
To deploy the bot, you need to set up a PostgreSQL database. Follow these steps:
- 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/
- Start PostgreSQL Service:
# On Ubuntu/Debian: sudo service postgresql start # On macOS: brew services start postgresql
- 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
- Check conetction:
psql -h localhost -U waffle -d waffledb
- 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" )
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