DiscordInteractions
An Elixir library for handling Discord interaction webhooks, which can be used to implement application commands with simple chat responses, as well as more complex user interfaces using components.
DiscordInteractions includes:
- A plug for handling incoming interaction requests, which implements security header validation
- Automatic registration of application commands with Discord at startup
- Discord REST API client
- Modules for generating interaction responses, and component and embed payloads
Installation
The package can be installed by adding discord_interactions to your list of dependencies in mix.exs:
def deps do
[
{:discord_interactions, "~> 0.1.0"}
]
endDocumentation can be found at https://hexdocs.pm/discord_interactions.
Development
Publishing to Hex.pm
This package is automatically published to Hex.pm when a new tag is pushed to the repository. The tag should follow the format vX.Y.Z (e.g., v0.1.0), and the version in the tag should match the version in mix.exs.
To publish a new version:
-
Update the version in
mix.exs - Commit your changes
-
Create and push a new tag:
git tag v0.1.0 git push origin v0.1.0
The GitHub Action will automatically run tests and publish the package to Hex.pm if all tests pass.
Note: You need to set up the HEX_API_KEY secret in your GitHub repository settings. You can get your Hex.pm API key by running mix hex.user key or from your Hex.pm dashboard.