Pycord Guide
  • Old Pycord Guide
  • FAQ
  • Pycord Discord
  • Getting Started
    • Creating a bot
    • Coding your bot
  • Guides
    • Threads
    • Voice Commands
    • Storing Data
    • Basic Features
      • Embeds
  • Interactions
    • Buttons
    • Dropdowns (Select Menus)
    • Context Menu Commands
    • Slash Commands
  • More
    • Installing Git
Powered by GitBook
On this page
  • What are User Commands and Message Commands?
  • How to create User Commands
  • How to create Message Commands

Was this helpful?

  1. Interactions

Context Menu Commands

How to make context menu commands with Pycord - detailed explanation with examples.

PreviousDropdowns (Select Menus)NextSlash Commands

Last updated 3 years ago

Was this helpful?

This guide has been moved to . Please visit the new guide instead, since this one might be outdated.

The new guide looks better, has better explanations, and is way better overall.

What are User Commands and Message Commands?

When you right click a message, you may see a option called "Apps". Hover over it and you can see commands a bot can run with that message. These are called message commands.

When you right click a message in the user list, you can once again see an option called "Apps". Hover over it and you can see commands a bot can run with that message. These are called user commands.

How to create User Commands

Very Simple!

@bot.user_command(guild_ids=[...])  # create a user command for the supplied guilds
async def mention(ctx, member: discord.Member):  # user commands return the member
    await ctx.respond(f"{ctx.author.name} just mentioned {member.mention}!")

If you want to make the command global, remove guild_ids. Note that global application commands can take up to an hour to register.

How to create Message Commands

Similar to user commands,

@bot.message_command(name="Show ID")  # creates a global message command. use guild_ids=[] to create guild-specific commands.
async def show_id(ctx, message: discord.Message):  # message commands return the message
    await ctx.respond(f"{ctx.author.name}, here's the message id: {message.id}!")

Docs:

Docs:

https://pycord.readthedocs.io/en/master/api.html#discord.Bot.user_command
https://pycord.readthedocs.io/en/master/api.html#discord.Bot.message_command
https://namantech.me/pycord
Preview of User commands and Message commands - click to expand