Absolutely — this project is a proof-of-concept Discord bot built entirely with AWS Lambda, EventBridge, and DynamoDB. It leverages Discord’s interaction endpoint to handle slash commands without maintaining a gateway connection.
The Core Module is the central entry point and shared infrastructure for the bot. It handles incoming interactions, signature verification, and provides the plumbing to route both Discord interactions and database changes via EventBridge.
See module docs for more details.
A minimal proof-of-concept command that respods to /tadaima command. Served as test for the bot's infrastructure and interaction handling along withthe CDK custom resource for command registration.
See module docs for more details.
- Node.js v22 - ideally use
nvmand install thhe required version specified in.nvmrcwithnvm install - PNPM - install globally with
npm install -g pnpm - AWS CLI and configured credentials
-
Clone the repository:
git clone https://github.com/Malanius/meido-bot.git
-
Install dependencies:
npx projen install
All CDK stacks follow the format: ${env}/${module-name}, env is taken from environment variable APP_ENV (default is dev), and module-name is the name of the module (e.g., core, tadaima).
-
Configure AWS credentials
aws configure [--profile <profile-name>]
-
Configure AWS region
Ensure your AWS CLI is configured to use the correct region where you want to deploy the bot. Stacks are region-less and will deploy to the region set in your AWS CLI configuration. You can set the region by exporting theAWS_REGIONenvironment variable:export AWS_REGION=eu-west-1 # or your preferred region
-
Bootstrap CDK in the account and region you want to deploy (required only once per account/region):
npx cdk bootstrap
-
Set the environment variable for the deployment environment
This is used to determine which CDK stacks to deploy. For example, to deploy to the development environment:export APP_ENV=dev -
Deploy the Core Module
This must be done first, as all other modules depend on shared resources.cdk diff dev/core cdk deploy dev/core
-
Configure Discord Secrets
After deploying the core module, populate required Discord credentials (e.g., bot token, public key) into AWS Secrets Manager. These must be in place before deploying any command modules.{ "appId": "Your application ID", "publicKey": "Your application public key", "botToken": "Your bot token", "guildId": "Optional, Guild ID for which the bot is enabled" } -
Configure interaction handler URL
After deploying the core module, set the interaction handler URL in your Discord application settings to the Lambda function URL provided by the core module. This is necessary for Discord to route interactions to your bot.- Go to your Discord Developer Portal
- Select your application
- Navigate to the "Bot" section
- Set the "Interaction Endpoint URL" to the Lambda function URL from the core module deployment output
-
Deploy Command Modules For each command module, run:
cdk diff dev/<module-name> cdk deploy dev/<module-name>
For example, to deploy the Ping module:
cdk diff dev/ping cdk deploy dev/ping
Each command module will register its slash command with Discord during deployment via a CDK custom resource.
