You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-6Lines changed: 39 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,7 @@ Get Daily Puzzles delivered to your preferred server channel with a "Is it Ruby
19
19
```
20
20
Check the .env.sample file for information on what environment variables you will need.
21
21
22
-
# Run the server and bot
23
-
24
-
Running the server (this is not necessary to run the bot):
25
-
`bundle exec rails server`
26
-
-or-
27
-
`bundle exec rails s`
22
+
# Run the Discord bot
28
23
29
24
Registering and re-registering the bot commands:
30
25
`bundle exec rake discord:reset_commands`
@@ -37,3 +32,41 @@ Be aware that it is possible to start the bot multiple times at once, and this c
37
32
This application is using `sidekiq` to run jobs.
38
33
Running sidekiq:
39
34
`bundle exec sidekiq -c 2 -q default`
35
+
36
+
# Optional Functionality
37
+
38
+
The Discord bot can run without the admin panel or Slackbot, those are optional features included with the project.
39
+
40
+
## Admin Panel
41
+
42
+
The admin panel allows you to manage puzzles and is set up with Google OAuth for authentication by default.
43
+
44
+
To run the admin panel with google, you'll need to create a google oauth client to get the client ID and secret.
45
+
46
+
Go to [Google Cloud Console](https://console.cloud.google.com/apis/credentials) and create a new OAuth 2.0 client ID.
47
+
Set the redirect URI to `http://localhost:3000/auth/google_oauth2/callback` for local development.
48
+
Copy the client ID and secret to your `.env` file as `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`.
49
+
50
+
Run the Rails server:
51
+
52
+
`bundle exec rails server`
53
+
-or-
54
+
`bundle exec rails s`
55
+
56
+
## Slackbot
57
+
58
+
The Slackbot supports a slash command to suggest new puzzles and notifications when running low on puzzles (less then 5 approved puzzles).
59
+
60
+
To set up the Slackbot, you'll need to create a Slack app:
61
+
62
+
1. Go to [Slack API](https://api.slack.com/apps) and create a new app.
63
+
2. Add a slash command (e.g., `/suggest_puzzle`) and set the endpoint of the request URL to `/slack/new_puzzle`.
64
+
3. Configure `Interactivity & Shortcuts` to point to the `/slack/puzzle` endpoint.
65
+
4. Install the Slack app to your workspace and add the bot token and secret to the `.env` file as `SLACK_TOKEN` and `SLACK_SIGNING_SECRET`.
66
+
5. To use the notifications feature, also set the `SLACK_NOTIFICATIONS_CHANNEL` in the `.env` file with the channel ID where you want to receive notifications.
67
+
6. Optionally, you can also tag a specific Slack user group in the notification, just set the `SLACK_GROUP_ID` in the `.env` file with the group ID.
68
+
69
+
Slack sends POST requests to the specified URLs, for local development, you can use a tool like [ngrok](https://ngrok.com/) to expose your local server to the internet.
70
+
Use the ngrok URL as the request URL for the slash command and interactivity in your Slack app settings.
71
+
72
+
The Slackbot will be ready to use once you have set up the Slack app and configured the environment variables. Make sure the Rails server is running.
DOMAIN_ALLOWLIST=<comma-separated list of allowed domains for google authentication> # optional, only if using Google OAuth and wanting to restrict access to certain domains
4
+
GOOGLE_CLIENT_ID=<google client id from google cloud oauth credentials> # optional, required if using the admin panel with Google OAuth
5
+
GOOGLE_CLIENT_SECRET=<google client secret from google cloud oauth credentials> # optional, required if using the admin panel with Google OAuth
6
+
RAILS_EMOJI_ID=<custom emoji id> # optional, if not set, will fallback to a default emoji
7
+
RUBY_EMOJI_ID=<custom emoji id> # optional, if not set, will fallback to a default emoji
8
+
SLACK_GROUP_ID=<slack group id> # optional, only if using Slackbot notification functionality
9
+
SLACK_NOTIFICATIONS_CHANNEL=<slack notifications channel id> # optional, only if using Slackbot notification functionality
10
+
SLACK_SIGNING_SECRET=<slack signing secret> # optional, only if using Slackbot functionality
11
+
SLACK_TOKEN=<slack signing secret> # optional, only if using Slackbot functionality
0 commit comments