Skip to content

Commit c759fb5

Browse files
committed
docs: Remove installation instructions from README, move to INSTALLATION.md; remove contributing guidelines from README, move to CONTRIBUTING.md; add links to new files and add INSTALLATION and USAGE files
1 parent bd01a42 commit c759fb5

3 files changed

Lines changed: 209 additions & 29 deletions

File tree

README.md

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ Code Module Cop is a powerful and flexible group management bot for Telegram and
2020

2121
### Installation
2222

23-
#### From Source
24-
2523
1. Clone the repository:
2624

2725
```bash
@@ -63,31 +61,7 @@ Code Module Cop is a powerful and flexible group management bot for Telegram and
6361
```bash
6462
npm start
6563
```
66-
67-
#### Docker Installation
68-
69-
You can also run CMCOP using Docker. This method allows you to quickly deploy the bot without needing to manually set up dependencies.
70-
71-
1. **Pull the Docker Image**
72-
73-
To pull the latest Docker image from Docker Hub:
74-
75-
```bash
76-
docker pull codemodule/cop
77-
```
78-
79-
2. **Run the Docker Container**
80-
81-
Run the container with the required environment variables. You can use a `.env` file to pass these variables:
82-
83-
```bash
84-
docker run -d \
85-
--name cop \
86-
--env-file .env \
87-
codemodule/cop
88-
```
89-
90-
If you need to link the container to a database container, you can use Docker Compose or specify additional environment variables directly in the `docker run` command.
64+
For detailed installation instructions, see the [INSTALLATION.md](./docs/INSTALLATION.md) file.
9165

9266
## Usage
9367

@@ -99,6 +73,8 @@ You can also run CMCOP using Docker. This method allows you to quickly deploy th
9973
- **/mute [time]**: Mute a user for a specified duration. Time can be specified in minutes (m), hours (h), or indefinitely.
10074
- **/ban**: Ban a user from the group permanently.
10175

76+
For detailed usage instructions, see the [USAGE.md](./docs/USAGE.md) file.
77+
10278
### Example
10379

10480
To mute a user for 10 minutes, use:
@@ -109,8 +85,6 @@ To mute a user for 10 minutes, use:
10985

11086
## Contributing
11187

112-
We welcome contributions from the community! To help us maintain the quality and consistency of the project, please follow these guidelines:
113-
11488
**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.
11589

11690
## License

docs/INSTALLATION.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Installation Guide
2+
This document provides detailed instructions on how to install and set up the Code Module Cop bot for managing Telegram groups.
3+
4+
## Prerequisites
5+
- Node.js (v20.x or higher)
6+
- npm (v6.x or higher)
7+
- Docker (if using Docker installation)
8+
- Mysql (such as Mariadb)
9+
## Installation
10+
### From Source
11+
1. Clone the Repository
12+
13+
```bash
14+
git clone https://github.com/CodeModule-ir/cop.git
15+
cd cop
16+
```
17+
### Install Dependencies
18+
```
19+
```bash
20+
npm install
21+
```
22+
23+
3. Set Up Environment Variables
24+
25+
Create a `.env` file in the root of your project directory with the following content:
26+
27+
```env
28+
TELEGRAM_BOT_TOKEN=your_bot_token_here
29+
DB_HOST=db
30+
DB_PORT=3306
31+
DB_USERNAME=your_db_username
32+
DB_PASSWORD=your_db_password
33+
DB_NAME=your_db_name
34+
```
35+
- **TELEGRAM_BOT_TOKEN**: Your Telegram bot token.
36+
- **DB_HOST**: The hostname of your database server.
37+
- **DB_PORT**: The port on which your database server is listening.
38+
- **DB_USERNAME**: The username used to access your database.
39+
- **DB_PASSWORD**: The password associated with the database username.
40+
- **DB_NAME**: The name of the database that the bot will use.
41+
4. Start the Bot
42+
43+
```bash
44+
npm start
45+
```
46+
47+
## Docker Installation
48+
You can also run the bot using Docker for easier setup and deployment.
49+
50+
1. Pull the Docker Image
51+
52+
Pull the Docker image from Docker Hub:
53+
54+
```bash
55+
docker pull codemodule/cop
56+
```
57+
58+
2. Run the Docker Container
59+
60+
Run the container with your environment variables:
61+
62+
```bash
63+
docker run -d \
64+
--name cop \
65+
--env-file .env \
66+
codemodule/cop
67+
```
68+
69+
Ensure you have a `.env` file with the necessary environment variables.
70+
71+
3. Using Docker Compose (Optional)
72+
73+
If you prefer using Docker Compose, create a docker-compose.yml file with the following content:
74+
75+
```yaml
76+
version: '3'
77+
services:
78+
bot:
79+
image: codemodule/cop
80+
env_file:
81+
- .env
82+
restart: always
83+
```
84+
Then, start the container with:
85+
86+
```bash
87+
docker-compose up -d
88+
```
89+
90+
### Updating
91+
To update the bot, pull the latest changes from the repository or Docker image and rebuild/restart the bot.
92+
93+
```bash
94+
git pull origin main
95+
npm install
96+
npm run build
97+
npm start
98+
```
99+
100+
### For Docker:
101+
102+
```bash
103+
docker pull codemodule/cop
104+
docker-compose down && docker-compose up -d
105+
```
106+
107+
### Additional Scripts
108+
109+
- Stop Docker Containers
110+
111+
```bash
112+
npm run docker:stop
113+
```
114+
- Take Down Docker Containers
115+
116+
```bash
117+
npm run docker:down
118+
```
119+
120+
- Build Docker Images
121+
```bash
122+
npm run docker:build
123+
```
124+
- Run Docker Containers
125+
126+
```bash
127+
npm run docker:run
128+
```
129+
- Start Docker Containers
130+
131+
```bash
132+
npm run docker:start
133+
```
134+
- Compile TypeScript Code
135+
136+
```bash
137+
npm run build
138+
```
139+
- Clean Distribution Directory
140+
141+
```bash
142+
npm run clean
143+
```
144+
- Run Node App
145+
bash
146+
```
147+
npm run main
148+
```

docs/USAGE.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Usage Guide
2+
This document provides detailed instructions on how to use the Code Module Cop bot for managing Telegram groups.
3+
4+
## Commands
5+
### General Commands
6+
- /start: Start interacting with the bot and receive a welcome message.
7+
- /help: Get assistance and see the list of available commands.
8+
## Moderation Commands
9+
- /warn [reason]: Issue a warning to a user. If a user accumulates three warnings, they will be automatically banned.
10+
- /rmWarn: Removes warnings from users.
11+
- /mute [time]: Mute a user for a specified duration. Time can be specified in minutes (m), hours (h), or indefinitely.
12+
- /unMute: Unsilences users.
13+
- /ban: Ban a user from the group permanently.
14+
- /unBan: Removes users from the banned list.
15+
- /purge: Deletes messages that have been replicated.
16+
## Role Management Commands
17+
- /approved: Grants users special permissions, such as using forbidden words and pinning messages.
18+
- /unApproved: Revokes special permissions from users.
19+
### Group Management Commands
20+
- /lock: Locks the group with additional options to lock gifs, stickers, or forwards.
21+
- /unLock: Unlocks the group with additional options to unlock gifs or stickers.
22+
- /blacklist: Returns the current blacklist.
23+
- /abl [word]: Adds a letter or word to the blacklist (e.g., /abl test).
24+
- /rmbl [word]: Removes a word from the blacklist (e.g., /rmbl test).
25+
### Information Commands
26+
- /date: Provides today’s date in Gregorian and solar calendars.
27+
- /future: Sends a predefined message about future plans.
28+
- /rules: Returns the group's rules and allows adding (/rules test) or deleting all rules (/rules r).
29+
## Examples
30+
### Mute a User for 10 Minutes
31+
32+
#### To mute a user for 10 minutes, use:
33+
34+
```plaintext
35+
/mute 10m
36+
(You must reply to the user you want to mute.)
37+
```
38+
#### Issue a Warning to a User
39+
To issue a warning to a user with a reason, use:
40+
41+
```plaintext
42+
/warn Spamming the chat
43+
(You must reply to the user you want to warn.)
44+
```
45+
#### Ban a User
46+
To ban a user from the group, use:
47+
48+
```plaintext
49+
/ban
50+
(You must reply to the user you want to ban.)
51+
```
52+
#### Unban a User
53+
To unban a user from the group, use:
54+
55+
```plaintext
56+
/unBan
57+
(You must specify the user to unban.)
58+
```

0 commit comments

Comments
 (0)