From 4b9bd0278267b34fc65a9ed0d0f1b8a1a29c0c8a Mon Sep 17 00:00:00 2001 From: Samlon Date: Mon, 11 Aug 2025 15:28:20 +0200 Subject: fixing not working skip --- cogs/music/queue.py | 24 --------------------- cogs/music/skip.py | 62 ----------------------------------------------------- cogs/music/stop.py | 14 ++++++++++++ main.py | 5 ++--- 4 files changed, 16 insertions(+), 89 deletions(-) delete mode 100644 cogs/music/queue.py delete mode 100644 cogs/music/skip.py create mode 100644 cogs/music/stop.py diff --git a/cogs/music/queue.py b/cogs/music/queue.py deleted file mode 100644 index d932838..0000000 --- a/cogs/music/queue.py +++ /dev/null @@ -1,24 +0,0 @@ -from discord.ext import commands - - -class Queue(commands.Cog): - def __init__(self, bot): - self.bot = bot - self.queues = {} - - def get_queue(self, guild_id): - return self.queues.setdefault(guild_id, []) - - @commands.slash_command(name="koleyjka", description="pokazuje koleyjke") - async def queue(self, ctx): - guild_id = ctx.guild.id - queue = self.get_queue(guild_id) - if queue: - queue_str = "\n".join(f"{i + 1}. {title}" for i, (_, title, _) in enumerate(queue)) - await ctx.respond(f"koleyjka:\n{queue_str}") - else: - await ctx.respond("koleyjka jest pustawa") - - -def setup(bot): - bot.add_cog(Queue(bot)) diff --git a/cogs/music/skip.py b/cogs/music/skip.py deleted file mode 100644 index b0023fe..0000000 --- a/cogs/music/skip.py +++ /dev/null @@ -1,62 +0,0 @@ -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)) diff --git a/cogs/music/stop.py b/cogs/music/stop.py new file mode 100644 index 0000000..e842b08 --- /dev/null +++ b/cogs/music/stop.py @@ -0,0 +1,14 @@ +from discord.ext import commands + + +class Stop(commands.Cog): + def __init__(self, bot): + self.bot = bot + + @commands.slash_command(name="stop", description="stopuj bota") + async def stop(self, ctx): + await ctx.voice_client.disconnect() + + +def setup(bot): + bot.add_cog(Stop(bot)) diff --git a/main.py b/main.py index 5993734..546ecb5 100644 --- a/main.py +++ b/main.py @@ -20,7 +20,7 @@ async def on_ready(): if __name__ == "__main__": load_dotenv() extensions = [ - "cogs.vc_logs", + "cogs.vclogs", "cogs.compression", 'cogs.tts', 'cogs.web', @@ -29,8 +29,7 @@ if __name__ == "__main__": 'cogs.downloader', 'cogs.music.play', 'cogs.music.play_compressed', - 'cogs.music.skip', - 'cogs.music.queue', + 'cogs.music.stop', 'cogs.music.join', 'cogs.music.leave', ] -- cgit v1.2.3