A Feature-rich Discord Bot Framework for Python with comprehensive API coverage and modern interfaces
npx @tessl/cli install tessl/pypi-discord-py-interactions@5.0.0A modern Python library for building Discord bots with slash commands and interactions.
Name: discord-py-interactions
Language: Python 3.10+
Installation: pip install discord-py-interactions
Repository: https://github.com/interactions-py/interactions.py
import interactions
from interactions import Client, AutoShardedClient, Intents
from interactions import slash_command, listen, Extensionimport interactions
from interactions import slash_command
bot = interactions.Client(token="YOUR_BOT_TOKEN", intents=interactions.Intents.DEFAULT)
@slash_command(name="hello", description="Say hello!")
async def hello(ctx):
await ctx.send("Hello World!")
bot.start()import interactions
from interactions import listen, slash_command, events
bot = interactions.Client(token="YOUR_BOT_TOKEN")
@listen()
async def on_ready(event: events.Ready):
print(f"Logged in as {event.user}")
@listen()
async def on_message_create(event: events.MessageCreate):
print(f"Message: {event.message.content}")
@slash_command(name="ping")
async def ping(ctx):
await ctx.send("Pong!")
bot.start()The library follows a modern, interaction-based architecture:
Client class@slash_command to define commands@listen()Extension systemManage bot lifecycle, configuration, and connection handling.
from interactions import Client, AutoShardedClient, Intents, Status, ActivityKey APIs:
Client(token, intents) { .api }AutoShardedClient(token) { .api }client.start() { .api }client.change_presence(status, activity) { .api }Comprehensive models for all Discord entities like guilds, users, channels, messages.
from interactions import Guild, User, Member, Channel, Message, Role, PermissionsKey APIs:
Guild.fetch_channels() { .api }User.send(content) { .api }Message.reply(content) { .api }Member.add_role(role) { .api }→ Full Discord Models Documentation
Create slash commands, context menus, and handle all interaction types.
from interactions import slash_command, context_menu, SlashContext, ModalContextKey APIs:
@slash_command(name, description) { .api }@context_menu(name, context_type=CommandType.USER) { .api }ctx.send(content, ephemeral=True) { .api }ctx.defer() { .api }Comprehensive event system covering Discord gateway events and internal bot events.
from interactions import listen, eventsKey APIs:
@listen() { .api }events.MessageCreate { .api }events.Ready { .api }events.GuildJoin { .api }Interactive components like buttons, select menus, and modals.
from interactions import Button, Modal, ActionRow, StringSelectMenuKey APIs:
Button(style=ButtonStyle.PRIMARY, label="Click Me") { .api }Modal(title="Form", components=[...]) { .api }@component_callback("button_id") { .api }@modal_callback("modal_id") { .api }→ Full Components Documentation
Extension system, converters, tasks, and utility functions.
from interactions import Extension, Task, Cooldown, checkKey APIs:
class MyExtension(Extension): ... { .api }@Task.create(IntervalTrigger(seconds=60)) { .api }@cooldown(Buckets.USER, 1, 30) { .api }@check(lambda ctx: ctx.author.id == OWNER_ID) { .api }