Java bot runs in a ECS-managed Docker image on an EC2 instance. It uses VPC endpoints to store and read into a DynamoDB Table holding the events. These interactions are hidden from the Internet.
Powered by Discord4J.
-
Manage events (create, view, & delete) for multiple discord servers.
-
Attend events using Discord emoji reactions.
Opt-in feature where a separate thread in the bot checks for events and notifies a channel 15 minutes before it occurs.
- Prod bot: Auto-scaled ECS service running the Java app with its own AWS DDB table
- Dev bot: Containerized Java app running locally with its own AWS DDB table
- You can have two application instances:
discord-events-bot
for prod anddiscord-events-bot-test
for dev. Create an application and associated bot for each desired instance through Discord developer portal. - Enable all Privileged Gateway Intents for each bot on the Discord developer portal.
- Add each bot to your desired servers with the following link (use CLIENT ID token from developer portal):
https://discordapp.com/api/oauth2/authorize?scope=bot&client_id=<YOUR CLIENT ID>
. - Set env vars in your shell:
Name Description AWS_ACCOUNT
AWS account ID AWS_DEFAULT_REGION
AWS region (ex: us-east-1
)AWS_ACCESS_KEY_ID
*AWS credentials AWS_SECRET_ACCESS_KEY
*AWS credentials DISCORD_BOT_TOKEN
Bot token from Discord Developer Portal DISCORD_EVENTS_ENV
Execution env for discord-events ( dev
|prod
)DISCORD_EVENTS_TABLE_NAME
Name your DDB table, the app will differentiate that of dev and prod
* Any AWS credentials setup can replace these for the bot's Java execution.
You can switch bots by changing the following env vars in your shell:
DISCORD_BOT_TOKEN
DISCORD_EVENTS_ENV
Aliases should do the trick:
alias botProd="export DISCORD_BOT_TOKEN=<your prod bot token> && export DISCORD_EVENTS_ENV=prod"
alias botDev="export DISCORD_BOT_TOKEN=<your dev bot token> && export DISCORD_EVENTS_ENV=dev"
- Deploy the CDK dev stack
- Switch to your dev bot
cd discord-events-cdk
yarn install && yarn run build
yarn run cdk deploy DiscordEventsDevStack
- From root dir,
docker-compose up
- Switch to your prod bot
cd discord-events-cdk
yarn install && yarn run build
yarn run cdk deploy DiscordEventsStack
You can always have your CI/CD pipeline deploy the newest version of your bot, just make sure that all the necessary environment variables (as indicated in setup) are set in the pipeline execution.
- Timezone defaulted to Eastern Canada, change in
utils/DateUtils.java
.