This serverless Discord Bot built using GEMISIS/discord-bot-cdk-construct serves you stored basket cookies for MediaMarkt and Saturn from a DynamoDB.
- MediaMarkt Austria
- MediaMarkt Germany
- MediaMarkt Spain
- Saturn
Clone repository, setup the AWS CDK.
You can restrict access to specific user roles, by setting the USER_ROLES
environment variable.
Configure the DynamoDB ARN by setting it as an environment variable COOKIE_ARN
, for example:
export COOKIE_ARN="arn:aws:dynamodb:eu-central-1:9999999:table/my-cookie-jar"
export USER_ROLES="12345678"
If you omit the ARN then the construct will create a new DynamoDB table for you.
You need to create a new Discord bot and register the Slash command (make sure to use the Bot token not the OAuth 2 token!). Ensure to configure two options: store
and productId
- or alter the code. ๐
To deploy the application, run cdk deploy
(see below for more commands).
In the AWS Secrets Manager, modify the created secret (paste it as plain text JSON object):
{
appId: "XXXXX",
publicKey: "XXXXX",
clientId: "XXXXX", // OAuth 2 - can be the same as appId
authToken: "XXXXX", // OAuth 2
}
Enter the CDK construct Lambda URL with the suffix /event
as your interaction URL.
Finally, configure the OAuth 2 scope (bot
and applications.commands
) and use the URL to add the bot to your server.
You can configure a comma separated list of user roles that should be allowed to access the slash command (variable USER_ROLES
). Violations are logged.
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template
Built by (c) Tim Brust and contributors. Released under the GPL v3 license.