GroupModerBot is a reliable Telegram moderation bot designed to help you maintain order in your groups. It provides administrators with a flexible warning system, allowing them to issue warnings, and automatically mute or ban repeat offenders based on configurable thresholds.
- βοΈ Warning System - Issue warnings to group members and set custom penalties. Includes an auto-mute feature where mute duration increases progressively using the Fibonacci sequence.
- π‘οΈ Fault Tolerance - The bot is completely crash-resistant. Exception handling ensures it stays online continuously unless the host runs out of memory or power.
- π Persistent Storage - All data (admins, warnings, group settings) is stored securely in an SQLite database. No data is lost upon restart or disconnection.
Follow these steps to launch the bot:
1. Download the latest release
- Go to the Releases.
- Download the
GroupModerBot_[Version]_[OperatingSystem].ziparchive and extract it to an empty folder. The path to the folder with .exe must not contain non-Latin letters. Do not separate the.exefrom the.dllfiles.
2. Get a bot token
- Create a new bot in @BotFather on Telegram.
- Send
/tokento get the bot token.
To function as a moderator, the bot needs specific permissions in BotFather:
- Send
/setjoingroups-> Select your bot -> Enable (Allows adding the bot to groups). - Send
/setprivacy-> Select your bot -> Disable (Allows the bot to read all messages in the group, which is required for reply-based commands).
3. Database setup
-
The bot requires an SQLite database to function. You have two options:
- Automatic (Recommended): Simply skip this step. If the configuration file does not contain
DbPath=, a fileGroupModerBotDatabase.dbcontaining the necessary structure will be automatically created in the folder with the.exe. - Manual: If you wish to use a custom location or filename, create a
.db(you can use DB Browser or SQLiteStudio for this, for example). The path to .db must not contain non-Latin letters. And then create the necessary tables in this database:
- Automatic (Recommended): Simply skip this step. If the configuration file does not contain
BotAdmins
CREATE TABLE "BotAdmins" (
"Id" INTEGER NOT NULL UNIQUE,
"FirstName" TEXT NOT NULL,
"LastName" TEXT NOT NULL,
"Username" TEXT NOT NULL,
"IsBot" INTEGER NOT NULL,
"IsPremium" INTEGER NOT NULL,
"IsBotOwner" INTEGER NOT NULL,
PRIMARY KEY("Id")
)Groups
CREATE TABLE "Groups" (
"Id" INTEGER NOT NULL UNIQUE,
"Title" TEXT NOT NULL,
"UniqueTitle" TEXT NOT NULL UNIQUE,
"Type" INTEGER NOT NULL CHECK("Type" >= 0 AND "Type" <= 3),
"IsBotAdmin" INTEGER NOT NULL CHECK("IsBotAdmin" = 0 OR "IsBotAdmin" = 1),
"IsBotActive" INTEGER NOT NULL CHECK("IsBotActive" = 0 OR "IsBotActive" = 1),
PRIMARY KEY("Id")
)GroupsSettings
CREATE TABLE "GroupsSettings" (
"Id" INTEGER NOT NULL UNIQUE,
"NumWarnToMute" INTEGER NOT NULL CHECK("NumWarnToMute" >= 0),
"NumWarnToBan" INTEGER NOT NULL CHECK("NumWarnToBan" >= 0),
FOREIGN KEY("Id") REFERENCES "Groups"("Id") ON DELETE CASCADE
)UserWarnings
CREATE TABLE "UsersWarnings" (
"Id" INTEGER NOT NULL,
"GroupId" INTEGER NOT NULL,
"QuantityWarn" INTEGER NOT NULL CHECK("QuantityWarn" >= 0),
PRIMARY KEY("Id","GroupId"),
FOREIGN KEY("GroupId") REFERENCES "Groups"("Id") ON DELETE CASCADE
)4. Configuration
- Open the DataForBot.txt file in the folder with the .exe.
- Fill in your BotToken and (optionally) your DbPath:
DbPath=C:\Users\UserName\Desktop\Database\DBForBot.db
BotToken=1234567890:AAFJmnuH50H05MqFwJZrrpI2FTRGTFCWK68
- IMPORTANT:
- Line order does not matter, but ensure there are no spaces around the
=sign. - Any other text or empty lines in the file will be ignored.
- If you remove
DbPath=, a.dbfile will be automatically created as described in step 3 (Automatic).
- Line order does not matter, but ensure there are no spaces around the
5. Run & Authenticate
- Run
GroupModerBot.exe. - If everything is configured correctly, you will see a successful initialization log in the console, ending with
[BOT] [EVENT] bot: "NameBot" has been launched. - Look for the confirmation code in the console output and copy it:
[PROGRAM] [EVENT] confirmation code: 255127673... - Open a private chat with your bot in Telegram and click Start.
- Claim ownership by sending the following command with your copied code:
/addAdmin 255127673...
The bot will reply: you have become a bot owner. You are now the owner of the bot and have full access to its functionality!
Syntax guide:
- Parameters:
< >= required,[ ]= optional. - Location: π = private chat, π₯ = groups.
- Access: π = owner, π‘οΈ = admin, π€ = guest.
| Command & Parameters | Location | Access | Description |
|---|---|---|---|
/start |
π | ππ‘οΈπ€ | Show available commands |
/groups |
π | ππ‘οΈ | List all groups containing the bot |
/setGroupUniqueTitle <OldUniqueTitle> <NewUniqueTitle> |
π | π | Change the uniqueTitle for a group |
/admins |
π | ππ‘οΈ | List all bot administrators |
/addAdmin [AdminConfirmationCode] |
π | ππ€ | π: Generate an AdminConfirmationCode. π€: Become the owner (if none exists) or an admin by entering the confirmation code |
/removeAdmin <AdminNumber> |
π | π | Remove an admin using their index number from /admins. Always use /admins first to get the correct number. |
/setWarnMuteSettings <QuantityWarnToMute> |
π | ππ‘οΈ | Set the number of warnings after which a group member will be muted. Default: 3. Mute duration (days) = Fibonacci(UserWarnsβQuantityWarnToMute). Example: If QuantityWarnToMute is 3 and the user receives the 7th warning, mute is Fibonacci(4) = 3 days |
/setWarnBanSettings <QuantityWarnToBan> |
π | ππ‘οΈ | Set the number of warnings before banning a group member. Default: 5 |
/botActive |
π₯ | π | Activates the bot. The bot begins executing commands in the group |
/botDeactive |
π₯ | π | Deactivate the bot. The bot stops executing commands in the group |
/addWarn [QuantityWarns] |
π₯ | ππ‘οΈ | Add the specified number of warnings to a member. Default: 1. Must be used as a reply to a user's message |
/removeWarn [QuantityWarns] |
π₯ | ππ‘οΈ | Remove the specified number of warnings to a member. Default: 1. Must be used as a reply to a user's message |
/setWarn <QuantityWarns> |
π₯ | ππ‘οΈ | Set the specified number of warnings for a member. Must be used as a reply to a user's message |
/viewWarn |
π₯ | ππ‘οΈ | Check the current number of warnings for a member. Must be used as a reply to a user's message |
Parameters Reference:
- UniqueTitle: A unique string (1-32 characters). Allowed:
A-z,0-9, and underscore_. - AdminConfirmationCode: A unique 32-character numeric verification string.
- AdminNumber: The specific index number retrieved from the
/adminslist. - QuantityWarns: An integer. Warns: cannot be negative.
- Linux support
- Full multithreading
- Logging to a file
- Improving the informativeness of logging
- Improving the bot's functionality
- Improving the bot's usability
-
Found a bug or have a suggestion? Feel free to open an issues.
-
If you want to support the project, please give it a star. β