Discord bot that traverses through the Riot Games API to find information about players of the game League of Legends.
Zoe is an IaC monorepo application that utilizes SST and Discord. Make sure to have the following installed and configured.
- /help - command list
- /setup - create guild instance
- /reset - reset instance
- /region <region> - change guild region
- /acknowledge - acknowledge dangerous commands
- /adduser <username> - add user to guild, user must be a valid League of Legends username
- /deluser <username> - delete user from guild, user must be a valid League of Legends username and exist
- /userlist - display guild userlist
- /speak - zoe will talk to you
- InfraStack - creates DynamoDb table to store user information
- BotStack - creates Lambda functions and events for Discord bot
- WebStack - creates Next.js web app for frontend UI
-
Create a new Application
-
Enable Privileged Gateway Intents under Bot
-
Invite to server with
https://discord.com/oauth2/authorize?client_id=<client_id>&permissions=536870912&scope=applications.commands%20bot
Note: Replace <client_id> with Application ID
-
After deploying the bot to AWS using either
npm run deploy
ornpm run deploy:prod
, paste InteractionsEndpoint into Interactions Endpoint URL under General Information
Set environment configuration config.json
{
"aws_region": "<AWS REGION>",
"riot_key": "<RIOT API KEY>",
"discord_public_key": "<DISCORD PUBLIC KEY>",
"application_id": "<DISCORD APPLICATION ID>",
"token": "<DISCORD BOT TOKEN>"
}
- aws_region - Region that AWS resources will be deployed to
- riot_key - obtained from Riot Developer Portal
- discord_public_key - found in Discord Developer Portal under General Information
- application_id - found in Discord Developer Portal under General Information
- token - found in Discord Developer Portal under Bot > Reset Token
The bot is configured to be able to deploy to multiple stages. This changes configurations in the AWS stack.
npm run deploy
- deploy dev stack, returns InteractionsEndpointnpm run deploy:prod
- deploy prod stack, returns InteractionsEndpoint, URL
-
In the Discord Application on Discord Developer Portal under OAuth2, create a redirect URL using URL/load
The redirect URL will look like this
https://abcdefghijklm.cloudfront.net/load
-
Under Authorization Method, choose In-app Authorization
-
Enable Scopes: bot, application.commands
-
Enable Bot Permissions: Manage Webhooks
Instructions to deploy SST apps using GitHub Actions can be found here
- Set environment configuration config.actions.json
{
"pat": "<GITHUB TOKEN>",
"owner": "<GITHUB REPO OWNER>",
"repo": "<GITHUB REPO>",
"aws_account_id": "<AWS ACCOUNT ID>",
"aws_region": "<AWS REGION>",
"riot_key": "<RIOT API KEY>",
"dev": {
"discord_public_key": "<DISCORD PUBLIC KEY>",
"application_id": "<DISCORD APPLICATION ID>",
"token": "<DISCORD BOT TOKEN>"
},
"prod": {
"discord_public_key": "<DISCORD PUBLIC KEY>",
"application_id": "<DISCORD APPLICATION ID>",
"token": "<DISCORD BOT TOKEN>"
}
}
- In configs, create secrets used by GitHub Actions using
npm run start
-
In the repo, under Settings > Secrets and variables > Actions, create three new repository secrets
- AWS_ACCOUNT_ID
- AWS_REGION
- RIOT_KEY
-
Repeat step 1 for Secrets and variables > Dependabot
-
Additionally, create a new environment called dev and create three new environment secrets
- APPLICATION_ID
- DISCORD_PUBLIC_KEY
- TOKEN
-
Repeat step 3 for prod