我试图用 nextcord 和 wavelink 创建一个音乐机器人,通过在 youtube 上看到一个教程,它是文本命令,但我试图执行斜线命令

I was trying to create a music bot with nextcord and wavelink, by seeing a tutorial on youtube, it was text command but im trying to do slash command

这是我制作音乐斜杠命令的代码

@drav.slash_command(name='play', description='Plays a song', guild_ids=[server])
async def play(interaction: Interaction, song: wavelink.YouTubeTrack):
    await interaction.response.defer(ephemeral=True, with_message=True)
    if not interaction.guild.voice_client:
        vc = wavelink.Player = await interaction.user.voice.channel.connect(cls=wavelink.Player)
    elif not getattr(interaction.user.voice, "channel", None):
        return await interaction.followup.send(embed=nextcord.Embed(title=':x: Join a voice channel yourself first!', color=nextcord.Colour.red()))
    else:
        vc: wavelink.Player = interaction.guild.voice_client

    await vc.play(song)
    await interaction.followup.send(Playing!)

它没有注册我的命令,因为我没有指定参数 song 必须是 str 或 int 但如果我这样做,我应该在哪里输入 wavelink.YouTubeTrach..... 请帮助 我尝试了多种方法,但无法弄清楚

尝试使用 pip install -U nextcord 更新您的下一根线。我可以在我的斜杠命令中不指定参数类型的情况下注册一个斜杠命令。

最后,当您在 discord developer portal 生成机器人邀请 link 时,您是否 select application.commands 选项?