Skip to content

Commit 21935ec

Browse files
Merge pull request #48 from Real-Dev-Squad/update-readme
update contributing.md
2 parents 9ccb5c9 + d2c2c9e commit 21935ec

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

CONTRIBUTING.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ DISCORD_APPLICATION_ID: Available in general panel of your discord bot.
2323
DISCORD_PUBLIC_KEY: Available in general panel of your discord bot.
2424
```
2525

26+
Now, generate a set of RSA keys 2048 bit in size.
27+
28+
We will use them as `BOT_PRIVATE_KEY` and `BOT_PUBLIC_KEY`
29+
2630
Please set Following permissions for your bot:
2731

2832
- Navigate to OAuth2 > URL Generator
@@ -54,9 +58,17 @@ This will register all the commands to your discord bot.
5458

5559
Now let's link our local development server to our bot.
5660

57-
- After all the commands are installed we need to save few secrets in wrangler cli.
58-
- run command `wrangler secret put DISCORD_TOKEN` and then enter the value of your token.
59-
- run command `wrangler secret put DISCORD_PUBLIC_KEY` and enter the public key.
61+
Run the command `npx wrangler publish`
62+
63+
- After all the commands are installed
64+
- Go to Your cloudflare `dashboard > workers > discord-slash-commands > settings > variables > edit Variables`
65+
- Now add following variables to your environment:
66+
67+
- `BOT_PRIVATE_KEY`
68+
- `DISCORD_GUILD_ID`
69+
- `DISCORD_PUBLIC_KEY`
70+
- `DISCORD_TOKEN`
71+
6072
- Now, start the local server with the command `npm start`
6173
- Once the wrangler starts make sure it is running on port `8787`
6274
- Once the server starts on desired port open another terminal and type in the command `npm run ngrok`
@@ -70,4 +82,22 @@ To verify if your bot is working:
7082
- Go to the server where your bot was invited
7183
- run a /hello command and the bot should reply with `Hello <Your_username>`
7284

85+
Now add the public key in `rds-backend`
86+
87+
- Go to `local.js` in config
88+
- Create following there
89+
90+
```
91+
botToken:{
92+
botPublicKey:<Public key generated in the format similar to development.js>
93+
}
94+
```
95+
96+
- Start the rds backend
97+
- Open a new terminal and run the following command `npx ngrok http <backend-port>`
98+
99+
- Go to `constants.js` in discord-slash-commands
100+
- Go to `src/constants/urls.ts`
101+
- Change the `RDS_BASE_DEVELOPMENT_API_URL` to the `ngrok https` url generated for rds backend
102+
73103
Now you are ready to contribute to the Repository.

wrangler.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name = "discord-slash-commands"
22
main = "src/index.ts"
33
compatibility_date = "2023-01-13"
4-
node_compat = true
4+
node_compat = true
5+
[vars]

0 commit comments

Comments
 (0)