Coder Social home page Coder Social logo

timbru31 / mms-discord-cookie-bot Goto Github PK

View Code? Open in Web Editor NEW
0.0 4.0 1.0 3.08 MB

Serverless Discord Bot built using GEMISIS/discord-bot-cdk-construct to retrieve stores cart cookies from MediaMarkt and Saturn

License: GNU General Public License v3.0

Shell 1.05% JavaScript 4.33% TypeScript 94.62%
discord discord-bot serverless aws aws-cdk mediamarkt saturn aws-lambda aws-lambda-node aws-dynamodb

mms-discord-cookie-bot's Introduction

Cookie Monster

This serverless Discord Bot built using GEMISIS/discord-bot-cdk-construct serves you stored basket cookies for MediaMarkt and Saturn from a DynamoDB.

Supported stores

  • MediaMarkt Austria
  • MediaMarkt Germany
  • MediaMarkt Spain
  • Saturn

Installation/Deployment

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.

Useful commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template

Built by (c) Tim Brust and contributors. Released under the GPL v3 license.

mms-discord-cookie-bot's People

Contributors

dependabot[bot] avatar timbru31 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

shingastar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.