Skip to content

Commit 593b0ba

Browse files
authored
Merge pull request #47 from UMLCloudComputing/fixgitignore
chore: unignore submodules changes and documentation
2 parents 96db485 + d778b0d commit 593b0ba

7 files changed

+204
-2
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
# Production
55
/build
6-
/docs/projects/
7-
/submodules
6+
# /docs/projects/
7+
# /submodules
88

99
# Generated files
1010
.docusaurus
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
## 👨‍💻 Contributing
6+
7+
Contributions are what make the open-source community an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
8+
9+
Follow these steps to contribute to the project with a new feature or bug fix:
10+
11+
### Step 1: Create a New Branch
12+
Before starting your work, ensure you're on the `main` branch and that it's up to date.
13+
14+
```sh
15+
git checkout main
16+
git pull origin main
17+
```
18+
19+
Create a new branch for your feature or bug fix. Follow a naming convention like `feature/<feature-name>` or `bugfix/<bug-name>`.
20+
21+
```sh
22+
git checkout -b feature/my-new-feature
23+
# or
24+
git checkout -b bugfix/my-bug-fix
25+
```
26+
27+
### Step 2: Make Your Changes
28+
Implement your feature or fix the bug in your branch. Commit your changes using clear, concise, and conventional commit messages following the guidelines at [conventionalcommits.org](https://www.conventionalcommits.org).
29+
30+
```sh
31+
git add .
32+
git commit -m "feat: add my new feature"
33+
# or
34+
git commit -m "fix: correct a bug"
35+
```
36+
37+
Optionally, if you assigned yourself an issue, you can automatically create and link a branch using the GitHub UI. Click on the "Create a branch" button and select the option to create a new branch for the issue.
38+
39+
### Step 3: Push Your Changes
40+
Push your changes to the repository.
41+
42+
```sh
43+
git push origin feature/my-new-feature
44+
# or
45+
git push origin bugfix/my-bug-fix
46+
```
47+
48+
#### Style Guide
49+
- Use clear, concise, and conventional commit messages. Commit messages should follow this specification https://www.conventionalcommits.org/en/v1.0.0/
50+
- Follow the best software development practices and write clean, maintainable code.
51+
- For ReactJS, follow this style guide: <https://dev.to/abrahamlawson/react-style-guide-24pp>. Except use indendantation of 4 spaces instead of 2.
52+
53+
### Step 4: Create a Pull Request
54+
Go to the GitHub repository page and click on the "Pull request" button. Select your branch and provide a detailed description of your changes. Explain why your changes should be merged into the main branch.
55+
56+
### Step 5: Review and Merge
57+
Wait for the project maintainers to review your pull request. They may request changes. Once your pull request is approved, a project maintainer will merge it into the main branch.
58+
59+
Thank you for your contribution!
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
## 🚀 Setting up.
6+
7+
### Dependencies
8+
9+
You need the following tools:
10+
- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
11+
- [Node.JS](https://github.com/nvm-sh/nvm)
12+
- Python `sudo apt install python3`
13+
- AWS CDK `npm install -g aws-cdk`
14+
15+
Then run
16+
`npm install`
17+
`pip install -r requirements.txt`
18+
19+
### Create your environment variable file
20+
21+
1. Create an `.env` file with the following variables. You will be needing these in the next step.
22+
```
23+
APP_NAME=
24+
PINECONE_URL =
25+
PINECONE_API_KEY =
26+
TOKEN=
27+
ID=
28+
DISCORD_PUBLIC_KEY=
29+
```
30+
</details>
31+
32+
2. Do not share this file with anyone. It contains your secret key.
33+
34+
35+
36+
37+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
sidebar_position: 3
3+
---
4+
5+
### Discord Application Setup
6+
7+
<details>
8+
<summary>Expand</summary>
9+
10+
1. Go to discord.dev and create a new application.
11+
12+
Navigate to application creation
13+
![image](https://github.com/UMLCloudComputing/rowdybot/assets/136134023/faa98e19-935e-4d27-a37d-afccdbb9cc77)
14+
15+
Put the name of your application here and accept the terms of service.
16+
![image](https://github.com/UMLCloudComputing/rowdybot/assets/136134023/cf796994-3e4d-4e8f-b208-0e191fa0a6d3)
17+
18+
2. Get your Bot ID, Secret Key, and Public Key. Examples of where you find them are below.
19+
20+
**Bot ID**:
21+
![image](https://github.com/UMLCloudComputing/rowdybot/assets/136134023/fc627f8a-ef30-4a3a-a8e3-1fc1dff7884c)
22+
23+
**Secret Key**:
24+
![image](https://github.com/UMLCloudComputing/rowdybot/assets/136134023/bead23af-2180-4ad3-a254-afb1d1d2121a)
25+
26+
**Public Key**:
27+
![image](https://github.com/UMLCloudComputing/rowdybot/assets/136134023/595f713f-c415-4b1d-937f-86929e0c5e00)
28+
29+
Save these in your .env file as
30+
```
31+
TOKEN= <Secret Key>
32+
ID= <Bot ID>
33+
DISCORD_PUBLIC_KEY= <Public Key>
34+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
sidebar_position: 4
3+
---
4+
5+
### Local Development Setup
6+
7+
1. Install the tools listed in the Dependencies section of the README.md
8+
2. Clone the repository to a your local device.
9+
3. Make sure you have a `.env` file.
10+
4. Add the following environmental variables `APP_NAME` and `PINECONE_URL` and `PINECONE_API_KEY` to the `.env` file.
11+
```
12+
# Discord
13+
TOKEN=
14+
ID=
15+
DISCORD_PUBLIC_KEY=
16+
17+
APP_NAME=
18+
PINECONE_URL =
19+
PINECONE_API_KEY =
20+
```
21+
5. Create an IAM user and give them full access to Amazon Bedrock, DynamoDB, S3, and AWS Lambda.
22+
6. Run `aws configure` to setup your AWS credentials.
23+
7. Create a Pinecone Account, and create a new index. Note down the URL of the Index in `PINECONE_URL`.
24+
8. `aws secretsmanager create-secret --name MySecret --secret-string '{"apiKey":"12345"}'` to create a secret in AWS Secrets Manager. Replace `12345` with your Pinecone API Key. Replace MySecret with the name of your secret.
25+
9. `aws secretsmanager describe-secret --secret-id MySecret --query 'ARN' --output text` to get the ARN of the secret. Replace MySecret with the name of your secret.
26+
10. Store the ARN in the `.env` file as `PINECONE_API_KEY`.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
sidebar_position: 5
3+
---
4+
5+
## 📦 Deploying
6+
7+
1. Run `cdk bootstrap` to setup the project for deployment.
8+
2. Deploy to lambda by running `cdk deploy`.
9+
3. If `cdk deploy` fails due to insufficient privileges to run docker, type `sudo cdk deploy`. If that doesn't work, type `sudo -i` to become root, `cd` back to the project root and run `cdk deploy` again.
10+
4. If successful, `cdk deploy` should have this: `DiscordBotLambdaTest.ApiGatewayUrl = <Your API Gateway URL>` in the output.
11+
5. Copy the API Gateway URL and go to your Discord Developer's Portal (discord.dev). Set this as Interactions Endpoint for your Bot.
12+
![image](https://github.com/UMLCloudComputing/rowdybot/assets/136134023/6e0171af-3151-4223-9590-b7d9953aca39)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
sidebar_position: 6
3+
---
4+
5+
## 👉 Commands
6+
7+
### Registering Commands
8+
1. Create an `.env` file in the root directory of the project. Do not upload this file to github, it contains secrets.
9+
2. Make sure these environmental variables are in your `.env` file.
10+
1. `TOKEN=<your discord bot token>`
11+
2. `ID=<your discord bot ID>`
12+
3. Enter new commands in this format, with each one on a new line in the file `commands/discord_commands.yaml`
13+
```
14+
- name: <name of your command>
15+
description: <command description>
16+
options:
17+
- name: <parameter 1>
18+
description: <parameter description>
19+
type: 3 # string
20+
required: true
21+
- name: <parameter 2>
22+
description: <parameter 2 description>
23+
type: 3 # string
24+
required: true
25+
```
26+
1. From your root directory, run `python3 register_commands.py`
27+
2. You should receive the status `201` or `200` printing out in your terminal.
28+
29+
### Defining Commands
30+
1. Commands can be defined in the file `src/app/main.py`
31+
2. You can register commands in the `interact` function by adding more `elif` statements.
32+
1. The parameters of the command that are received from the user is in encoded in the variable `data`. The statement `data["options"][n]["value"]` will extract the argument `n`.
33+
2. The message that the bot returns to the user is specified in the string variable `message_content`. It is crucial that `message_content` is a string.
34+
3. Following the example of the `/weather` command, you may choose to call an external function that returns a string for better code readability.

0 commit comments

Comments
 (0)