disagreement/docs/context_menus.md
Slipstreamm 9237d12a24 docs(imports): Update import paths in documentation examples
Adjust examples to reflect the new top-level exposure of classes and enums, such as `Client`, `Permissions`, `Embed`, and `Button`, making imports simpler.
2025-06-14 18:44:04 -06:00

22 lines
739 B
Markdown

# Context Menu Commands
`disagreement` supports Discord's user and message context menu commands. Use the
`user_command` and `message_command` decorators from `ext.app_commands` to
define them.
```python
from disagreement import User, Message
from disagreement.ext.app_commands import user_command, message_command, AppCommandContext
@user_command(name="User Info")
async def user_info(ctx: AppCommandContext, user: User) -> None:
await ctx.send(f"User: {user.username}#{user.discriminator}")
@message_command(name="Quote")
async def quote(ctx: AppCommandContext, message: Message) -> None:
await ctx.send(message.content)
```
Add the commands to your client's handler and run `sync_commands()` to register
them with Discord.