from discord.ext import commands class Skip(commands.Cog): def __init__(self, bot): self.bot = bot @commands.slash_command(name="pomiń", description="przeskocz do nastepnej melodyji") async def pomin(self, ctx): """Skip the current song and play the next one in the queue.""" vc = ctx.voice_client if not vc or not vc.is_connected(): await ctx.respond("Nie jestem połączony z kanałem głosowym.") return if not vc.is_playing() and not vc.is_paused(): await ctx.respond("Nic nie jest teraz odtwarzane.") return # Get the play cog play_cog = self.bot.get_cog('Play') if not play_cog: await ctx.respond("Błąd: Nie można znaleźć modułu odtwarzania.") return queue = play_cog.get_queue(ctx.guild.id) if not queue: await ctx.respond("Kolejka jest pusta.") return # Stop the current song (this will trigger play_next in the after callback) vc.stop() await ctx.respond("Pominięto aktualną piosenkę.") @commands.slash_command(name="kolejka", description="pokaż aktualną kolejkę") async def queue_list(self, ctx): """Show the current queue.""" play_cog = self.bot.get_cog('Play') if not play_cog: await ctx.respond("Błąd: Nie można znaleźć modułu odtwarzania.") return queue = play_cog.get_queue(ctx.guild.id) if not queue: await ctx.respond("Kolejka jest pusta.") return queue_list = [] for i, (title, _) in enumerate(queue[:10], 1): # Show up to 10 songs queue_list.append(f"{i}. {title}") if len(queue) > 10: queue_list.append(f"...i {len(queue) - 10} więcej") await ctx.respond("\n".join(["**Kolejka:**"] + queue_list)) def setup(bot): bot.add_cog(Skip(bot))