A personal Discord bot to handle miscellaneous tasks hosted on AWS Lambda.
| Command | Description |
|---|---|
/coinflip |
Flips a coin |
/ping |
Ping |
/roll |
Rolls a dice with modifiers |
From the project home directory:
- Endpoint Function:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags lambda.norpc -o binary/bootstrap ./cmd/endpoint/ - Task Function:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags lambda.norpc -o binary/bootstrap ./cmd/task/
Zip the bootstrap binaries and upload it to the Lambda functions.
- Rename
config.example.jsontoconfig.jsonand add in the values. - From the project directory, run the following command:
go run .
NAME:
dreamingway - sync discord commands
USAGE:
dreamingway [global options]
GLOBAL OPTIONS:
--verbose, -v enable verbose logging (default: false)
--config string, -c string path to the configuration file (default: "config.json")
--config-string string configuration as a json string
--help, -h show help
| Name | Description |
|---|---|
DEBUG |
Enable debug mode |
DISCORD_BOT_APPLICATION_ID |
Discord Bot Application ID |
DISCORD_BOT_PUBLIC_KEY |
Discord Bot Public Key |
DISCORD_BOT_TOKEN |
Discord Bot Token |
TASK_FUNCTION_NAME |
Name of the Task Lambda Function |
| Name | Description |
|---|---|
CLOUDFLARE_API_TOKEN |
Cloudflare API Token |
CLOUDFLARE_ZONE_ID |
Cloudflare Zone ID |
DISCORD_API_VERSION |
Discord API Version |
DISCORD_BOT_TOKEN |
Discord Bot Token |
PZ_DISCORD_ADMIN_ROLE |
Discord Admin Role for the Project Zomboid |
PZ_HOST |
Project Zomboid Host IP/URL |
PZ_HOST_INSTANCE_ID |
AWS Instance ID of the Project Zomboid Host |
PZ_HOST_REGION |
AWS Instance ID of the Project Zomboid Host |
PZ_RCON_PASSWORD |
RCON Password of the Project Zomboid server |
PZ_RCON_PORT |
RCON Port of the Project Zomboid server |
To quickly spin up dreamingway-bot on AWS, use the Terraform module.
- Create the endpoint Lambda function on AWS.
- For the
Runtime, selectAmazon Linux 2023. - For the
Architecture, selectx86_64.
- For the
- Add an API Gateway triger to the endpoint Lambda function.
- Use the following settings:
- Intent: Create a new API
- API type: REST API
- Security: Open
- Use the following settings:
- Create the task Lambda function on AWS.
- For the
Runtime, selectAmazon Linux 2023. - For the
Architecture, selectx86_64.
- For the
- Build the endpoint and task binaries.
- Archive the
bootstrapbinaries in .zip files and upload it to the Lambda functions. - In the
Configurationtab, add in the required environment variables to the Lambda functions. - Change the
Timeoutof the task Lambda function to a value greater than 3 seconds.- The
Timeoutof the endpoint Lambda function can stay as 3 seconds to follow Discord's requirements.
- The
Get the endpoint Lambda API Gateway triggers' API endpoint and add it to the Discord bot's Interactions Endpoint URL in the Discord Developer Portal.
In the OAuth2 URL Generator, give the following scopes when adding the bot to a server:
applications.commandsbot
Manage Roles
