Skip to content

slash command option input type "mentionable" issue #906

@V9X

Description

@V9X

Summary

When you mention role in slash command, exception occures

Reproduction Steps

run code below and try to mention a role in slash command

Minimal Reproducible Code

bot = discord.Bot()
@bot.slash_command(guild_ids=["id"])
async def command(
    ctx,
    var: discord.Option((discord.Role, discord.User))
):
    print(var)

bot.run("token")

Expected Results

  • if user mentioned in slash command, prints user object. ✅

  • if role mentioned in slash command, prints role object. ❌

Actual Results

  • The following traceback is printed:
Ignoring exception in command <discord.commands.SlashCommand name=command>:
Traceback (most recent call last):
  File "C:\Users\{username}\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 110, in wrapped
  File "C:\Users\{username}\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 334, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10013): Unknown User

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\{username}\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 520, in process_application_commands
    await ctx.command.invoke(ctx)
  File "C:\Users\{username}\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 306, in invoke
    await injected(ctx)
  File "C:\Users\{username}\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 116, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: NotFound: 404 Not Found (error code: 10013): Unknown User

Intents

all

System Information

  • Python v3.10.2-final
  • py-cord v2.0.0-beta
    • py-cord pkg_resources: v2.0.0b4897+g4dadb69d
  • aiohttp v3.8.1
  • system info: Windows 10 10.0.22000

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmed bugA bug report that needs triaging

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions