Skip to content

SlashCommandOptionType.user doesn't work #1120

Closed
@s-fabian

Description

@s-fabian

Summary

SlashCommandOptionType.user doesn't work

Reproduction Steps

I tried to make a slash command containing the SlashCommandOptionType.user type, and there it started making trouble. I've tried Option(pycord.Member) too, with exact the same result.

Minimal Reproducible Code

@bot.slash_command(name="kick", guild_ids=[...])
async def command(ctx, member: pycord.SlashCommandOptionType.user):
    pass

Expected Results

The bot starts

Actual Results

Traceback (most recent call last):
File "/var/global/justmorebot/main.py", line 383, in
async def kick_user_command(interaction: pycord.Interaction, member: pycord.SlashCommandOptionType.user):
File "/home/heroclay/.local/lib/python3.8/site-packages/discord/bot.py", line 822, in decorator
result = command(**kwargs)(func)
File "/home/heroclay/.local/lib/python3.8/site-packages/discord/commands/core.py", line 1457, in decorator
return cls(func, **attrs)
File "/home/heroclay/.local/lib/python3.8/site-packages/discord/commands/core.py", line 590, in init
self.options: List[Option] = self._parse_options(params)
File "/home/heroclay/.local/lib/python3.8/site-packages/discord/commands/core.py", line 638, in _parse_options
option = Option(option, "No description provided")
File "/home/heroclay/.local/lib/python3.8/site-packages/discord/commands/options.py", line 124, in init
_type = SlashCommandOptionType.from_datatype(input_type)
File "/home/heroclay/.local/lib/python3.8/site-packages/discord/enums.py", line 654, in from_datatype
if datatype.name in ["Member", "User"]:
AttributeError: 'str' object has no attribute 'name'

Intents

guild_reactions, messages, bans, guilds

System Information

  • Python v3.8.10-final
  • py-cord v2.0.0-beta
    • py-cord pkg_resources: v2.0.0b4
  • aiohttp v3.7.4.post0
  • system info: Linux 5.4.0 #1 SMP Thu Apr 22 16:18:59 MSK 2021

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

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions