Wavelink
Wavelink copied to clipboard
Slash commands & menus
Hello, i created a musicbot and now want to completly switch from textcommands to slashcommands. everything working now exopect the menus. the bot is adding the reactions but if they become pressed nothing is happening. i not changed anything there and before at the point where i used textcommands it worked. i alredy asked in the slashcommand supportserver but the owner told me that he cant help cause its out of his knowlage. it would be nice if anyone could help me with that....
Hi there, I'm sure there are people who'd love to help you with this. However, could you perhaps provide some of your code and some more details on how to replicate the problem? It'll help other people try to figure out what exactly your problem is and how to fix it. Thanks, and I hope this helped!
menucommands looking like this:
@menus.button(emoji='\u23ED')
async def skip_command(self, payload: discord.RawReactionActionEvent):
"""Skip button."""
ctx = self.update_context(payload)
command = self.bot.get_command('skip')
ctx.command = command
await self.bot.invoke(ctx)
@menus.button(emoji='\U0001F500')
async def shuffle_command(self, payload: discord.RawReactionActionEvent):
"""Shuffle button."""
ctx = self.update_context(payload)
command = self.bot.get_command('shuffle')
ctx.command = command
await self.bot.invoke(ctx)
_#####################################################################
#####################################################################_
**Music Slashcommands looking like this:**
@cog_ext.cog_slash(name="play", guild_ids=slash_ids)
async def play(self, ctx, *, query: str, channel: discord.VoiceChannel = None):
"""Play or queue a song with the given query."""
player: Player = self.bot.wavelink.get_player(guild_id=ctx.guild.id, cls=Player, context=ctx)
channel = getattr(ctx.author.voice, 'channel', channel)
if channel is None:
raise NoChannelProvided
if not player.is_connected:
await player.connect(channel.id)
query = query.strip('<>')
if not URL_REG.match(query):
query = f'ytsearch:{query}'
tracks = await self.bot.wavelink.get_tracks(query)
```
Did you remove the commands like connect
, pause
by any chance?
You could try the new ui buttons maybe reactions are buggy on slash commands