При регистрации слэш команды play в когах, бот пишет ошибку
@commands.slash_command(name='play', description='Playing Music')
async def _play(self, ctx: commands.Context, *, search: str):
if not ctx.voice_state.voice:
await ctx.invoke(self._join)
async with ctx.typing():
try:
source = await YTDLSource.create_source(ctx, search, loop=self.bot.loop)
except YTDLError as e:
await ctx.send('Произошла ошибка при обработке этого запроса: {}'.format(str(e)))
else:
song = Song(source)
await ctx.voice_state.songs.put(song)
await ctx.send('Успешно добавлено {}'.format(str(source)))
@_join.before_invoke
@_play.before_invoke
async def ensure_voice_state(self, ctx: commands.Context):
if not ctx.author.voice or not ctx.author.voice.channel:
raise commands.CommandError('Сначала подключись к голосовому.')
if ctx.voice_client:
if ctx.voice_client.channel != ctx.author.voice.channel:
raise commands.CommandError('Бот уже подключен с голосовому каналу.')
Вот ошибка:
C:\Users\User\AppData\Local\Programs\Python\Python312\python.exe C:\Users\User\Desktop\AgainstEvil\cogs\music.py
Traceback (most recent call last):
File "C:\Users\User\Desktop\AgainstEvil\cogs\music.py", line 248, in
class Music(commands.Cog):
File "C:\Users\User\Desktop\AgainstEvil\cogs\music.py", line 383, in Music
@commands.slash_command(name='play', description='Playing Music')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\disnake\ext\commands\slash_core.py", line 825, in decorator
return InvokableSlashCommand(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\disnake\ext\commands\slash_core.py", line 452, in __init__
options = expand_params(self)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\disnake\ext\commands\params.py", line 1094, in expand_params
_, inter_param, params, injections = collect_params(command.callback, sig)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\disnake\ext\commands\params.py", line 1000, in collect_params
paraminfo = ParamInfo.from_param(parameter, {}, doc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\disnake\ext\commands\params.py", line 627, in from_param
self.parse_annotation(type_hints.get(param.name, param.annotation))
File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\disnake\ext\commands\params.py", line 784, in parse_annotation
raise TypeError(f"{annotation!r} is not a valid parameter annotation")
TypeError: is not a valid parameter annotation
Подскажите пожалуйста, как исправить ее.