Skip to content

Commit 647ebf4

Browse files
authored
Update README, added documents for setup + contributing (#330)
* added set up dev env section to onboarding doc * added making features and issues sections * more changes * addressed comments
1 parent 500a8a3 commit 647ebf4

File tree

4 files changed

+123
-8
lines changed

4 files changed

+123
-8
lines changed

README.md

+15-8
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,27 @@ Set these into your `.env` file. Make sure to not push these changes to git.
3434

3535
- `DISCORD_TOKEN`: the bot's token, found in the Discord Developer Portal. DO NOT REVEAL THIS TOKEN; ANYONE WITH THIS TOKEN CAN CONTROL YOUR BOT.
3636

37-
## Prerequisites
37+
### Setting up the bot
3838

39-
- [Yarn](https://classic.yarnpkg.com/en/docs/install)
40-
- [Docker](https://docs.docker.com/get-docker/) (tested up to v20.10.6)
39+
You can follow the instructions outlined [in this document](docs/SETUP.md).
4140

42-
## Running the bot locally
41+
### Contributing
4342

44-
1. Build docker image: `yarn image:build`
45-
1. Start container in detached mode: `yarn start`
46-
1. View and follow console output: `yarn logs`
43+
You can follow the steps [in this document](docs/CONTRIBUTING.md).
4744

48-
## Other usage
45+
## Commands
4946

47+
### Using Docker
48+
- Build the container: `yarn image:build`
49+
- Start the container: `yarn start`
5050
- Stop the container: `yarn stop`
5151
- Stop and remove the container: `yarn clean`
5252
- Restart the container: `yarn restart`
5353
- Fresh build and restart: `yarn image:build && yarn clean && yarn start`
54+
55+
### Locally
56+
- Run the project: `yarn ts:build && yarn local:run`
57+
58+
### Miscellaneous
59+
- Run linter: `yarn lint`
60+
- Format code: `yarn format`

assets/botPerms.png

103 KB
Loading

docs/CONTRIBUTING.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Contributing
2+
3+
Make sure you have set up your development environment first, as described [in this document](./SETUP.md).
4+
5+
## Requesting features for the bot
6+
7+
We always welcome new feature requests for the bot! :D
8+
9+
### Through the Discord server
10+
11+
1. Join the CSC Discord server through [this link](https://discord.gg/pHfYBCg).
12+
13+
2. All public Codey-related discussions occur in the **Codey Corner** category in the server.
14+
15+
3. You can post your suggestion in the `#codey-suggestions` channel.
16+
17+
4. If enough people show interest, you can create an issue on the main GitHub repository for your feature request, or ask one of the Codey developers to create an issue on your behalf.
18+
19+
### Through GitHub
20+
21+
1. You can view all the current feature requests [here](https://github.com/uwcsc/codeybot/issues).
22+
23+
2. To request a new feature, click **New Issue**, and click the **Feature Request** template.
24+
25+
3. Fill in the details of your feature request.
26+
27+
## Making features for the bot
28+
29+
1. Before working on a feature, make an issue, as described in the previous section. We want to document what people are working on - we can avoid two people working on the same feature.
30+
31+
2. If you wish to work on the issue, ask one of the CodeyBot developers to assign you to the issue.
32+
33+
3. When you're done, make a PR from your branch to `master`. Make sure to link/reference the issue which contains your feature request in your PR.
34+
35+
> Make sure to include screenshots/a demo of your feature request, if applicable.
36+
37+
4. Before your PR can be merged, you need to pass the pipeline. The most common reasons why the pipeline fails are because the linter or formatter checks fail. To solve this, you can run `yarn lint` to see any linting issues you might have, or `yarn format` to format your code.

docs/SETUP.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Setting up the bot locally
2+
3+
1. Make sure you have the following prerequisites installed:
4+
- Git
5+
- [Yarn](https://classic.yarnpkg.com/en/docs/install)
6+
- [Docker](https://docs.docker.com/get-docker/)
7+
8+
2. Fork the repository and clone it into the directory of your choice.
9+
10+
> This is not necessary for CodeyBot developers - you can work directly from the main repository.
11+
12+
3. Set up your Discord testing server.
13+
14+
> For CodeyBot developers, we have our own dedicated testing server - ask your team lead for more details.
15+
16+
4. Set up your Discord testing bot for Codey, and add your bot to the Discord testing server. Make sure it has the following perms:
17+
18+
![botperms](../assets/botPerms.png)
19+
20+
5. In your cloned project, create a `dev` folder in `config`, and create a `vars.json` file in it. Fill the JSON file with the corresponding values for each of the variables as described in the main README.md.
21+
22+
6. Make an `.env` file in the root folder of the project, and put your Discord bot's token:
23+
```
24+
DISCORD_TOKEN=<insert token here>
25+
```
26+
DO NOT REVEAL THIS: ANYONE WITH THIS HAS ACCESS TO YOUR BOT.
27+
28+
7. Run `yarn` in the root folder of your project to install all the dependencies required.
29+
30+
### Running the bot using Docker
31+
32+
8. Run `yarn image:build` to create and build the Docker image for the bot.
33+
34+
9. If you run `docker image ls`, you should see `codey:latest` as one of the Docker images.
35+
36+
10. Next, run `yarn start` to start the bot. If this is run successfully, you should see a similar output to the following:
37+
```
38+
yarn run v1.22.18
39+
$ docker-compose up -d
40+
codey-bot is up-to-date
41+
Done in 1.07s.
42+
```
43+
11. Run `yarn logs` to see the logs of the bot.
44+
45+
12. If everything is set up correctly, you should see your bot send a message in the configured notification channel (the channel assigned to `NOTIF_CHANNEL_ID` in your `vars.json`):
46+
47+
> Codey is up! App version: \<app version>
48+
49+
13. To stop the bot, run `yarn stop`. To stop the bot and remove the container, run `yarn clean`.
50+
51+
### Running the bot locally
52+
53+
You can choose to run the bot locally instead of using Docker. This is helpful if Docker is not working as intended.
54+
55+
8. Install the dependencies `ghostscript` and `graphicsmagick` locally. This is required for the resume pdf->image converter functionality of Codey.
56+
57+
For example, on Mac and some Linux distros, you can do:
58+
```
59+
sudo apt install ghostscript
60+
sudo apt install graphicsmagick
61+
```
62+
63+
9. Run `yarn ts:build` to build the bot locally. If this run successfully, you should see a `dist` folder in your project, which contains all the compiled JS code.
64+
65+
10. Next, run `yarn local:run` to run the bot locally. Note that the logs are printed directly into the console output.
66+
67+
11. If everything is set up correctly, you should see your bot send a message in the configured notification channel (the channel assigned to `NOTIF_CHANNEL_ID` in your `vars.json`):
68+
69+
> Codey is up! App version: \<app version>
70+
71+
12. If you wish to stop the bot, just stop the command.

0 commit comments

Comments
 (0)