'NextCord: Error using converters in slash commands

I have a background with discord.py and pycord, and I decided to try nextcord slash commands so I decided to create some commands, in this I got a peculiar error message

@slash_command(name='suggestions_set', guild_ids=[956174862815199252])
async def suggestions_set(self, interaction: Interaction, channel: TextChannel):
   db.insert({'channel': channel.id})
   await interaction.send(f'**The suggestions channel has been set to {channel.mention}**')

I got the following error:

Traceback (most recent call last):
  File "C:\Users\angel\anaconda3\envs\spybot\lib\site-packages\nextcord\ext\commands\bot.py", line 675, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\angel\Code\Python\spybot\cogs\info.py", line 6, in <module>
    class Info(Cog):
  File "C:\Users\angel\Code\Python\spybot\cogs\info.py", line 10, in Info
    async def suggestions_set(self, interaction: Interaction, channel: SlashOption):
  File "C:\Users\angel\anaconda3\envs\spybot\lib\site-packages\nextcord\application_command.py", line 1981, in decorator
    app_cmd = ApplicationCommand(
  File "C:\Users\angel\anaconda3\envs\spybot\lib\site-packages\nextcord\application_command.py", line 1418, in __init__
    super().__init__(
  File "C:\Users\angel\anaconda3\envs\spybot\lib\site-packages\nextcord\application_command.py", line 602, in __init__
    self._from_callback(callback)
  File "C:\Users\angel\anaconda3\envs\spybot\lib\site-packages\nextcord\application_command.py", line 820, in _from_callback
    arg = CommandOption(param, self)
  File "C:\Users\angel\anaconda3\envs\spybot\lib\site-packages\nextcord\application_command.py", line 327, in __init__
    self.type: ApplicationCommandOptionType = self.get_type(parameter.annotation)
  File "C:\Users\angel\anaconda3\envs\spybot\lib\site-packages\nextcord\application_command.py", line 384, in get_type
    raise NotImplementedError(
NotImplementedError: Type "<class 'nextcord.application_command.SlashOption'>" isn't a supported typing for Application Commands.

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

Traceback (most recent call last):
  File "C:\Users\angel\Code\Python\spybot\bot.py", line 19, in <module>
    bot.load_extension(f'cogs.{file[:-3]}')
  File "C:\Users\angel\anaconda3\envs\spybot\lib\site-packages\nextcord\ext\commands\bot.py", line 789, in load_extension
    self._load_from_module_spec(spec, name, extras=extras)
  File "C:\Users\angel\anaconda3\envs\spybot\lib\site-packages\nextcord\ext\commands\bot.py", line 678, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
nextcord.ext.commands.errors.ExtensionFailed: Extension 'cogs.info' raised an error: NotImplementedError: Type "<class 'nextcord.application_command.SlashOption'>" isn't a supported typing for Application Commands.

I understand this must be some type implementations error but I don't understand it, If someone could tell what I am doing wrong?



Solution 1:[1]

channel: TextChannel = SlashOption(...) should work according to the examples in their github repository.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Enoki