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.0from 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
- Getting startedInstall the module and run a bot with a slash command and a button.
- Buttons and select menusButtons, links, select menus and reading the selected values.
- Components V2Containers, sections, thumbnails, galleries, files and separators.
- ModalsForms with text, select menus, radio buttons, checkboxes and file uploads.
- Slash commandsDeclare commands, their typed options, groups and autocomplete.
- Cooldowns and permissionsRate-limit commands and control who can use them, and where.
- Routing and custom_idSend every click to its function, carry data and sign it.
- Messages and updatesSend, reply, defer, edit, then change the components of an existing message.
- Upgrading to 0.3What changes between 0.2 and 0.3, and what to adapt.
Reference
- Buttons3
- Select menus8
- Builders16
- Components V213
- Modal fields7
- Types and constants5
- Building modals1
- Reading values4
- Sending and replying11
- Updating components10
- Payloads3
- Routing1
- Signed custom_id5
- Shortcuts4
- custom_id5
- HTTP1
- Slash commands5
- Context2
- Options22
- Permissions21
- Cooldowns10
- Autocomplete9
- Middlewares9
- Localization5
- Sync3
- Errors14
- Pseudo containers (deprecated)6
- Other2