|
1 | 1 | # Code Module Cop - Telegram Group Management Bot |
2 | 2 |
|
3 | 3 | [](https://t.me/cmcopbot) |
| 4 | +[](./LICENSE) |
| 5 | +[](https://nodejs.org/) |
| 6 | +[](https://www.npmjs.com/) |
4 | 7 |
|
5 | | -Code Module Cop is a powerful and flexible group management bot for Telegram and a dedicated [CodeModule](https://t.me/CodeModule) bot designed to help admins manage and moderate their groups effectively. This bot offers various features including welcome messages, role management, auto replies, and more. |
| 8 | +**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. |
| 9 | + |
| 10 | +For more information, join our [Telegram Group](https://t.me/cmcopbot) or check out the [CodeModule](https://t.me/CodeModule) bot! |
6 | 11 |
|
7 | 12 | ## Features |
8 | 13 |
|
9 | | -- **Moderation Tools**: Mute and ban users with automated handling of warnings. |
10 | | -- **Welcome Messages**: Custom welcome messages for new members. |
11 | | -- **Role Management**: Manage roles for admins, moderators, and members. |
12 | | -- **Logging and Analytics**: Track group activity and generate reports. |
| 14 | +### 🔒 Moderation Tools |
| 15 | + |
| 16 | +- Mute and ban users with automated warnings. |
| 17 | +- Automated handling of rule violations. |
| 18 | + |
| 19 | +### 🎉 Welcome Messages |
| 20 | + |
| 21 | +- Fully customizable welcome messages for new members. |
| 22 | + |
| 23 | +### 🛡️ Role Management |
| 24 | + |
| 25 | +- Assign and manage roles for admins, moderators, and members. |
13 | 26 |
|
14 | 27 | ## Getting Started |
15 | 28 |
|
16 | 29 | ### Prerequisites |
17 | 30 |
|
18 | | -- Node.js (v20.x or higher) |
19 | | -- npm (v6.x or higher) |
| 31 | +Before you begin, ensure you have the following installed: |
| 32 | + |
| 33 | +- [Node.js](https://nodejs.org/) (v20.x or higher) |
| 34 | +- [npm](https://www.npmjs.com/) (v6.x or higher) |
20 | 35 |
|
21 | 36 | ### Installation |
22 | 37 |
|
23 | | -1. Clone the repository: |
| 38 | +1. **Clone the repository**: |
| 39 | + |
| 40 | + First, clone the repository to your local machine: |
| 41 | + |
| 42 | + ```bash |
| 43 | + git clone https://github.com/CodeModule-ir/cop.git |
| 44 | + cd cmcop |
| 45 | + ``` |
24 | 46 |
|
25 | | - ```bash |
26 | | - git clone https://github.com/CodeModule-ir/cop.git |
27 | | - cd cmcop |
28 | | - ``` |
| 47 | +2. **Install dependencies**: |
29 | 48 |
|
30 | | -2. Install dependencies: |
| 49 | + Install the necessary dependencies via npm: |
31 | 50 |
|
32 | | - ```bash |
33 | | - npm install |
34 | | - ``` |
| 51 | + ```bash |
| 52 | + npm install |
| 53 | + ``` |
35 | 54 |
|
36 | | -3. **Set Up Environment Variables** |
| 55 | +3. **Set Up Environment Variables** |
37 | 56 |
|
38 | | - The bot requires specific environment variables to run correctly. These are stored in a `.env` file in the root directory of your project. This file should not be committed to version control, so ensure it is listed in your `.gitignore`. |
| 57 | + The bot requires environment variables to function correctly. Create a `.env` file in the root directory of your project and add the following variables: |
39 | 58 |
|
40 | | - Create a `.env` file in the root of your project directory with the following content: |
| 59 | + ```env |
| 60 | + TELEGRAM_BOT_TOKEN=your_bot_token |
| 61 | + DB_USER=your_db_user |
| 62 | + DB_PASSWORD=your_db_password |
| 63 | + DB_HOST=localhost |
| 64 | + DB_NAME=your_db_name |
| 65 | + DB_PORT=5432 |
| 66 | + DB_URL=postgres://your_db_user:your_db_password@localhost:5432/your_db_name |
| 67 | + DATABASE_URL=postgresql://your_db_user:your_db_password@host:port/database_name // Production |
| 68 | + PORT=3000 |
| 69 | + WEB_HOOK=https://your-webhook-url-here |
| 70 | + NODE_ENV=development |
| 71 | + ``` |
41 | 72 |
|
42 | | - ```env |
| 73 | + > Note: Be sure to replace placeholders like `your_bot_token` and `your_db_user` with your actual values. The `.env` file should **never** be committed to version control. |
43 | 74 |
|
44 | | - TELEGRAM_BOT_TOKEN=your_bot_token |
45 | | - DB_USER= |
46 | | - DB_HOST= |
47 | | - DB_NAME= |
48 | | - DB_PASSWORD= |
49 | | - DB_PORT= |
50 | | - DB_URL=postgres://username:password@host:port/database_name |
51 | | - DATABASE_URL='' // for production |
52 | | - ``` |
| 75 | +4. **Start the Bot** |
53 | 76 |
|
54 | | -4. **Start the Bot** |
| 77 | + Once the environment variables are set, you can start the bot by running the following command: |
55 | 78 |
|
56 | | - With the environment variables set, you can start the bot: |
| 79 | + ```bash |
| 80 | + npm start |
| 81 | + ``` |
57 | 82 |
|
58 | | - ```bash |
59 | | - npm start |
60 | | - ``` |
| 83 | + This will run the bot in **development mode**. For production deployment, set the `NODE_ENV` to `production`. |
61 | 84 |
|
62 | | - For detailed installation instructions, see the [INSTALLATION.md](./docs/INSTALLATION.md) file. |
| 85 | + For additional installation instructions, check the [INSTALLATION.md](./docs/INSTALLATION.md) file. |
63 | 86 |
|
64 | 87 | ## Usage |
65 | 88 |
|
66 | 89 | ### Commands |
67 | 90 |
|
| 91 | +Below are the most commonly used commands in Code Module Cop: |
| 92 | + |
68 | 93 | - **/start**: Start interacting with the bot and receive a welcome message. |
69 | | -- **/help**: Get assistance and see the list of available commands. |
70 | | -- **/warn [reason]**: Issue a warning to a user. If a user accumulates three warnings, they will be automatically banned. |
71 | | -- **/mute [time]**: Mute a user for a specified duration. Time can be specified in minutes (m), hours (h), or indefinitely. |
| 94 | +- **/help**: Display available commands and their descriptions. |
| 95 | +- **/warn [reason]**: Issue a warning to a user. Accumulating three warnings will result in an automatic ban. |
| 96 | +- **/mute [time]**: Mute a user for a specified time. Time can be in minutes (e.g., 10m), hours (e.g., 2h), or indefinitely. |
72 | 97 | - **/ban**: Ban a user from the group permanently. |
73 | 98 |
|
74 | | -For detailed usage instructions, see the [USAGE.md](./docs/USAGE.md) file. |
75 | | - |
76 | 99 | ### Example |
77 | 100 |
|
78 | 101 | To mute a user for 10 minutes, use: |
79 | 102 |
|
80 | 103 | ```plaintext |
81 | | -/mute 10m (You must reply to the user.) |
| 104 | +/mute 10m (Reply to the user you want to mute.) |
82 | 105 | ``` |
83 | 106 |
|
| 107 | +For more detailed usage instructions, refer to the [USAGE.md](./docs/USAGE.md) file. |
| 108 | + |
| 109 | +## Development |
| 110 | + |
| 111 | +Running in Development Mode |
| 112 | +To run the bot in development mode, use: |
| 113 | + |
| 114 | +```bash |
| 115 | +npm run start |
| 116 | +``` |
| 117 | + |
| 118 | +This starts the bot with ts-node for TypeScript support and includes stack traces for debugging. |
| 119 | + |
84 | 120 | ## Contributing |
85 | 121 |
|
86 | | -**Read the Contributing Guidelines**: Before you start, please read our [CONTRIBUTING.md](./docs/CONTRIBUTING.md) file. It contains important information about how to contribute, including coding standards, how to set up your development environment, and the process for submitting changes. |
| 122 | +We welcome contributions to improve Code Module Cop. Before you start contributing, please review our [CONTRIBUTING.md](./docs/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. |
| 123 | + |
| 124 | +Please ensure that your contributions adhere to the project's coding guidelines and include proper test coverage where necessary. |
87 | 125 |
|
88 | 126 | ## License |
89 | 127 |
|
90 | | -This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
| 128 | +Code Module Cop is open-source and licensed under the **MIT License**. You can read more about the license in the [LICENSE](LICENSE) file. |
| 129 | + |
| 130 | +## Acknowledgments |
| 131 | + |
| 132 | +- [Grammy](https://grammy.dev) - A library for building Telegram bots. |
| 133 | +- [Node.js](https://nodejs.org) - The runtime environment for this bot. |
| 134 | +- [PostgreSQL](https://www.postgresql.org) - The database used to store user data and group logs. |
| 135 | + |
| 136 | +## Support |
| 137 | + |
| 138 | +Need help? Join our [Telegram Chat](https://t.me/cmcopbot) or [open an issue in the GitHub Repository](https://github.com/CodeModule-ir/cop/issues). |
0 commit comments