-
-
Notifications
You must be signed in to change notification settings - Fork 484
Closed as not planned
Labels
unconfirmed bugA bug report that needs triagingA bug report that needs triaging
Description
Summary
string returned for slash commands when using Option/input_type
Reproduction Steps
Create slash command with Option and input_type fields.
Minimal Reproducible Code
import discord
from discord.commands import Option
@bot.slash_command(name="working")
async def test_member1(ctx: discord.ApplicationContext, member: Option(discord.Member, "Choose a member")):
await ctx.respond(f"Member: {member.mention}")
@bot.slash_command(name="not_working")
async def test_member2(ctx: discord.ApplicationContext, member: Option(input_type=discord.Member, description="Choose a member")):
await ctx.respond(f"Member: {member.mention}")Expected Results
Get a discord.Member object when using input_type in the Option constructor.
Actual Results
Got a string value.
Ignoring exception in command not_working:
Traceback (most recent call last):
File "C:\Users\ReenigneArcher\Documents\GitHub\LizardByte\support-bot\venv\Lib\site-packages\discord\commands\core.py", line 131, in wrapped
ret = await coro(arg)
^^^^^^^^^^^^^^^
File "C:\Users\ReenigneArcher\Documents\GitHub\LizardByte\support-bot\venv\Lib\site-packages\discord\commands\core.py", line 1013, in _invoke
await self.callback(ctx, **kwargs)
File "C:\Users\ReenigneArcher\Documents\GitHub\LizardByte\support-bot\src\discord_bot.py", line 192, in test_member2
await ctx.respond(f"Member: {member.mention}")
^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'mention'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\ReenigneArcher\Documents\GitHub\LizardByte\support-bot\venv\Lib\site-packages\discord\bot.py", line 1130, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\ReenigneArcher\Documents\GitHub\LizardByte\support-bot\venv\Lib\site-packages\discord\commands\core.py", line 376, in invoke
await injected(ctx)
File "C:\Users\ReenigneArcher\Documents\GitHub\LizardByte\support-bot\venv\Lib\site-packages\discord\commands\core.py", line 139, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'str' object has no attribute 'mention'Intents
discord.Intents.all()
System Information
python -m discord -v
C:\Users...\support-bot\venv\Lib\site-packages\discord_main_.py:33: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
- Python v3.11.0-final
- py-cord v2.5.None-final
- aiohttp v3.8.6
- system info: Windows 10 10.0.22621
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
unconfirmed bugA bug report that needs triagingA bug report that needs triaging