discord-interactions.py

discord-interactions-py

Components V2, modals and slash commands for discord.py, through direct Discord API calls.

Installation

pip install levraiberet-discord-interactions==0.3.0
from discord_interactions import container, create_buttonfrom discord_interactions.slash import SlashManager slash = SlashManager(client) @slash.command(description="Carte")async def carte(ctx):    await ctx.respond(components=[        container(accent_color=0x5865F2).add("## Bonjour").row(create_button("ok", "OK"))    ])

Guides

  1. Getting startedInstall the module and run a bot with a slash command and a button.
  2. Buttons and select menusButtons, links, select menus and reading the selected values.
  3. Components V2Containers, sections, thumbnails, galleries, files and separators.
  4. ModalsForms with text, select menus, radio buttons, checkboxes and file uploads.
  5. Slash commandsDeclare commands, their typed options, groups and autocomplete.
  6. Cooldowns and permissionsRate-limit commands and control who can use them, and where.
  7. Routing and custom_idSend every click to its function, carry data and sign it.
  8. Messages and updatesSend, reply, defer, edit, then change the components of an existing message.
  9. Upgrading to 0.3What changes between 0.2 and 0.3, and what to adapt.

Reference

Type a name: create_button, ModalBuilder, cooldown.