Code Module Cop is a powerful and flexible Telegram bot designed for managing and moderating Telegram groups. This bot provides a set of advanced features such as role management, automated moderation, logging, and more, helping administrators manage their groups efficiently. It is built with the aim of streamlining group moderation and automating tasks that would otherwise require manual intervention.
For more information, join our Telegram Group or check out the CodeModule bot!
- Mute and ban users with automated warnings.
- Automated handling of rule violations.
- Fully customizable welcome messages for new members.
- Assign and manage roles for admins, moderators, and members.
Before you begin, ensure you have the following installed:
-
Clone the repository:
First, clone the repository to your local machine:
git clone https://github.com/CodeModule-ir/cop.git cd cmcop
-
Install dependencies:
Install the necessary dependencies via npm:
npm install
-
Set Up Environment Variables
The bot requires environment variables to function correctly. Create a
.env
file in the root directory of your project and add the following variables:TELEGRAM_BOT_TOKEN=your_bot_token DB_USER=your_db_user DB_PASSWORD=your_db_password DB_HOST=localhost DB_NAME=your_db_name DB_PORT=5432 DB_URL=postgres://your_db_user:your_db_password@localhost:5432/your_db_name DATABASE_URL=postgresql://your_db_user:your_db_password@host:port/database_name // Production PORT=3000 WEB_HOOK=https://your-webhook-url-here NODE_ENV=development
Note: Be sure to replace placeholders like
your_bot_token
andyour_db_user
with your actual values. The.env
file should never be committed to version control. -
Start the Bot
Once the environment variables are set, you can start the bot by running the following command:
npm start
This will run the bot in development mode. For production deployment, set the
NODE_ENV
toproduction
.For additional installation instructions, check the INSTALLATION.md file.
Below are the most commonly used commands in Code Module Cop:
- /start: Start interacting with the bot and receive a welcome message.
- /help: Display available commands and their descriptions.
- /warn [reason]: Issue a warning to a user. Accumulating three warnings will result in an automatic ban.
- /mute [time]: Mute a user for a specified time. Time can be in minutes (e.g., 10m), hours (e.g., 2h), or indefinitely.
- /ban: Ban a user from the group permanently.
To mute a user for 10 minutes, use:
/mute 10m (Reply to the user you want to mute.)
For more detailed usage instructions, refer to the USAGE.md file.
Running in Development Mode To run the bot in development mode, use:
npm run start
This starts the bot with ts-node for TypeScript support and includes stack traces for debugging.
We welcome contributions to improve Code Module Cop. Before you start contributing, please review our CONTRIBUTING.md file. This document contains important guidelines regarding our coding standards, how to set up your development environment, and the process for submitting changes.
Please ensure that your contributions adhere to the project's coding guidelines and include proper test coverage where necessary.
Code Module Cop is open-source and licensed under the MIT License. You can read more about the license in the LICENSE file.
- Grammy - A library for building Telegram bots.
- Node.js - The runtime environment for this bot.
- PostgreSQL - The database used to store user data and group logs.
Need help? Join our Telegram Chat or open an issue in the GitHub Repository.