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.
- Windows x64 (Tested on Windows 10)
- Linux on GLIBC 2.35 or higher (Tested on WSL2: Ubuntu 22.04 LTS and Ubuntu 24.04 LTS)
Dependencies
The following dependencies are not required for the pre-built binaries to run.
- βοΈ 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 - 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 the binary file must not contain non-Latin letters. Windows: 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 binary file. - Manual: If you wish to use a custom location or filename, create a
.dbfile (you can use DB Browser or SQLiteStudio for this, for example). The path to.dbmust not contain non-Latin letters. 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.txtfile in the folder with the binary file. - Fill in your
BotToken, (optionally) yourDbPath, and (optionally)EnableProcessPendingUpdates:
DbPath=C:\Users\UserName\Desktop\Database\DBForBot.db
BotToken=1234567890:AAFJmnuH50H05MqFwJZrrpI2FTRGTFCWK68
EnableProcessPendingUpdates=true
-
EnableProcessPendingUpdates- Enables or disablesProcessPendingUpdates. IfProcessPendingUpdatesis enabled, the bot will ignore all commands and events sent to it while it was offline that are not directly related to the bot. The bot will only process its own movements within groups and changes to its status within groups.true,t, and1are defined as true.false,f, and0are defined as false. -
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). - If you remove
EnableProcessPendingUpdates=,ProcessPendingUpdateswill be considered enabled.
- Line order does not matter, but ensure there are no spaces around the
5. Run & Authenticate
- Run the
GroupModerBotbinary. - 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:
/add_admin 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 |
/set_group_unique_title <OldUniqueTitle> <NewUniqueTitle> |
π | π | Change the UniqueTitle for a group |
/admins |
π | ππ‘οΈ | List all bot administrators |
/add_admin [AdminConfirmationCode] |
π | ππ€ | π: Generate an AdminConfirmationCode. π€: Become the owner (if none exists) or an admin by entering the confirmation code |
/remove_admin <AdminNumber> |
π | π | Remove an admin using their index number from /admins. Always use /admins first to get the correct number. |
/set_warn_mute_settings <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 |
/set_warn_ban_settings <QuantityWarnToBan> |
π | ππ‘οΈ | Set the number of warnings before banning a group member. Default: 5 |
/bot_active |
π₯ | π | Activates the bot. The bot begins executing commands in the group |
/bot_deactive |
π₯ | π | Deactivate the bot. The bot stops executing commands in the group |
/add_warn [QuantityWarns] |
π₯ | ππ‘οΈ | Add the specified number of warnings to a member. Default: 1. Must be used as a reply to a user's message |
/remove_warn [QuantityWarns] |
π₯ | ππ‘οΈ | Remove the specified number of warnings from a member. Default: 1. Must be used as a reply to a user's message |
/set_warn <QuantityWarns> |
π₯ | ππ‘οΈ | Set the specified number of warnings for a member. Must be used as a reply to a user's message |
/view_warn |
π₯ | ππ‘οΈ | Check the current number of warnings for a member. Must be used as a reply to a user's message |
/disable_bot |
π | π | Turn off the bot completely |
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. Warnings: cannot be negative.
- Full multithreading
- Logging to a file
-
Found a bug or have a suggestion? Feel free to open an issue.
-
If you want to support the project, please give it a star. β