Expand description

Discord interactions with AWS Lambda!

A light-weight, easy-to-use library for building Discord bots under the Discord interaction modal. Integrates with AWS Lambda. Much of a Discord bot’s behavior can be described using an request/response model, which a slash command, button press, or other user interaction is sent to a backend, and the backend returns a single response. This request/response is called an interaction by Discord, which is specified in detail in the Discord developer docs. This library wraps these request and response types, handling authentication, exposing application-friendly types, and integrating these types with AWS Lambda.

Structs

  • An top level interaction initiated by the user. Application commands do not require any existing conversation with the bot to be occurring. Currently, only chat application commands (slash commands) are fully supported.
  • A button component, which the user can interact with. If a user clicks such a button, it will spawn a message component interaction.
  • A message response, resulting in a message in chat.
  • An interaction caused by the user’s interaction with a message component embedded in a chat message. Currently, only button presses are supported.
  • A modal response, which allows the user to input text information. A modal cannot be a response to a modal submit interaction.
  • An interaction type caused by the user submitting a completed modal form. Modals are the primary way of retrieving text input from the user.
  • A message that a message component or modal was originally attached to. This allows the application to maintain some notion of “state”, by reasoning based on the source message’s text.
  • A text field included in a modal.

Enums

  • A response to an interaction. This response can either be a message in chat, or a modal, which will pop up over the user’s screen.

Traits

  • General interaction handler type, to be implemented by your application. To implement this trait, you must at minimum be able to handle incoming application commands (slash commands). If your application involves buttons or modal inputs, you should implement the corresponding trait functions as well.

Functions

  • Sets up an interaction handler on AWS Lambda to receive and process incoming Discord interactions. This function takes in an application public key, which should match the one provided with your Discord bot.