Skip to content

Instantly share code, notes, and snippets.

View jsleep's full-sized avatar

Jon Sleep jsleep

View GitHub Profile
@jb3
jb3 / README.md
Last active September 25, 2024 14:34
A simple implementation of Discord Slash Commands in Python with Microsoft Function Apps.

Dice rolling — Discord Interaction Edition

This is a very basic Discord Interaction designed to run on Azure Function Apps using the Python runtime.

Steps to get running

  1. Head to Discord and create a new application, take note of the Client ID, Client Secret and Interactions Public Key.
  2. Create a new Azure function app with the code in azure_function.py, make sure to add an app setting called INTERACTION_PUBLIC_KEY with the value taken from Discord. Make sure to add discord_interactions to your requirements.txt file, the function depends on it!
  3. Place the URL of your App Function HTTP trigger into the Discord Developer portal. If things are working it will allow you to save.
  4. Add the application to your server by visiting the OAuth2 URL generator in the Developer portal and creating a link with the application.commands scope.