🤖 Open Source Community Assistance Robot
🤖
OSCAR is a Discord bot built to assist the Open-Source Hub community.
- 🔧 Manage OSCAR in the Discord developer dashboard
- 👩🏿💻 Check out Open Source Hub repository
- 👾 Visit the Discord channel
/verify
: checks that the caller is the maintainer of at least one project on opensourcehub.io. If so, that user will receive the role of "Maintainer".
OSCAR runs on Node 16 and recommends Yarn for dependency management.
OSCAR also requires environment variables to connect to the right services. Create a .env
at the root of your directory, and add the variables defined in the .env.sample file.
- Clone the repository to your computer
- Navigate into the cloned directory
- Run
yarn install
to install the necessary dependencies - Run
yarn dev
to start OSCAR
OSCAR is deployed as a web worker to Heroku.
- Install the Heroku CLI on your machine. You can check whether the CLI is installed correctly by running:
heroku -v
- Add the Heroku remote. This will ask you to log in to Heroku, which you can do using the credentials in 1Password.
heroku git:remote -a oscar-discord
Run the following command to deploy your code to Heroku:
yarn deploy
This is an alias for:
git push heroku main
When we add new commands or update their name, we need to upload the latest commands to each server that uses the bot.
This is done with the following code:
const commands = [
new SlashCommandBuilder()
.setName("verify")
.setDescription(
"Grants the Maintainer role for maintainers of repositories listed on opensourcehub.io"
),
].map((command) => command.toJSON());
See src/setup-commands.ts
for the source.
We've provided a shell command that executes that code using 3 arguments:
-t
: the bot token-a
: the application id (aka "client id")-g
: the guild id (aka "server id")
For example:
yarn upload:commands -t 'bot.token.goes.here' -a 'application_id' -g 'guild_id'
Tail the Heroku logs locally:
heroku logs --tail
OSCAR is not listed in the Discord Bot directory because we want to control where it is installed. So for now, it needs to be added to servers manually.
Visit the Discord Developer Portal, choose the OSCAR application, then navigate to "OAuth2" > "URL Generator".
There, you'll need to check 2 scopes and 1 permission:
- scope: bot
- scope: application.commands
- permission: Administrator
Then, copy the generated URL at the bottom and paste it in your browser. Discord will take you through the rest of the process.