Search code examples
discorddiscord.py

Is it possible to choose only specific discord users to show user context menu interactions on via discord py interactions?


I am working in discord-py-interactions. I want to limit what users show certain context menu interactions when they are clicked on. For example, I want to only show most commands on the bot when it is clicked on.

@user_context_menu(name="get_id", scopes=[1095478300228472982])
async def repeat(ctx: interactions.ContextMenuContext):
    member: interactions.Member = ctx.target
    await ctx.send(member.id)

This code gives me an error because that scopes parameter is meant for guild ids, not user ids. Is this doable another way though?


Solution

  • You cannot. The commands.CommandTree.context_menu documentation does not support any parameter to apply this context menu for specific users only.