A personal Discord bot to handle miscellaneous tasks hosted on AWS Lambda.
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/
https://github.com/kn-lim/dreamingway-bot/tree/main/cmd/cli
Name | Description |
---|---|
TASK_FUNCTION_NAME |
Name of the Task Lambda Function |
Name | Description |
---|---|
DISCORD_BOT_APPLICATION_ID |
Discord Bot Application ID |
DISCORD_BOT_PUBLIC_KEY |
Discord Bot Public Key |
DISCORD_BOT_TOKEN |
Discord Bot Token |
Name | Description |
---|---|
DISCORD_API_VERSION |
Discord API Version |
DISCORD_BOT_TOKEN |
Discord Bot Token |
Name | Description |
---|---|
PIXELMON_NAME |
AWS Name Tag of Pixelmon EC2 Instance |
PIXELMON_INSTANCE_ID |
AWS Instance ID of Pixelmon EC2 Instance |
PIXELMON_REGION |
AWS Region of Pixelmon EC2 Instance |
PIXELMON_HOSTED_ZONE_ID |
AWS Hosted Zone ID of Domain |
PIXELMON_DOMAIN |
Domain of Pixelmon Server |
PIXELMON_SUBDOMAIN |
Subdomain of Pixelmon Server |
PIXELMON_RCON_PASSWORD |
RCON Password of Pixelmon Service |
PIXELMON_ROLE_ID |
Role ID to allow /pixelmon command |
- Create an endpoint Lambda function on AWS.
- For the
Runtime
, selectProvide your own bootstrap on Amazon Linux 2
underCustom runtime
. - For the
Architecture
, selectx86_64
. - Under
Advanced Settings
, select:Enable function URL
- Auth type:
NONE
- Invoke mode:
BUFFERED (default)
- Enable
Configure cross-origin resource sharing (CORS)
- Auth type:
- For the
- Create a task Lambda function on AWS.
- For the
Runtime
, selectProvide your own bootstrap on Amazon Linux 2
underCustom runtime
. - For the
Architecture
, selectx86_64
.
- For the
- Archive the
bootstrap
binary in a .zip file and upload it to the Lambda functions. - In the
Configuration
tab, add in the required environment variables to the Lambda functions. - Give the role the endpoint Lambda function is using permission to run the task Lambda function.
- Give the role the task Lambda function is using permission to access the AWS resources it will need.
- Change the
Timeout
of the task Lambda function to a value greater than 3 seconds.- The
Timeout
of the endpoint Lambda function can stay as 3 seconds to follow Discord's requirements.
- The
- Get the endpoint Lambda function's
Function URL
and add it to the Discord bot'sInteractions Endpoint URL
in the Discord Developer Portal.- If it saves properly, that indicates your Lambda function is properly configured to act as a Discord bot.