aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/music
diff options
context:
space:
mode:
authorSamlon <stankiewiczgracjan2019@gmail.com>2025-08-11 15:28:20 +0200
committerSamlon <stankiewiczgracjan2019@gmail.com>2025-08-11 15:28:20 +0200
commit4b9bd0278267b34fc65a9ed0d0f1b8a1a29c0c8a (patch)
tree0000a9333411bd9054f959d0e7efa2398a7e71db /cogs/music
parentplay.py fix (diff)
downloadsenator-sperma-4b9bd0278267b34fc65a9ed0d0f1b8a1a29c0c8a.tar.gz
senator-sperma-4b9bd0278267b34fc65a9ed0d0f1b8a1a29c0c8a.zip
fixing not working skip
Diffstat (limited to 'cogs/music')
-rw-r--r--cogs/music/queue.py24
-rw-r--r--cogs/music/skip.py62
-rw-r--r--cogs/music/stop.py14
3 files changed, 14 insertions, 86 deletions
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 @@
1from discord.ext import commands
2
3
4class Queue(commands.Cog):
5 def __init__(self, bot):
6 self.bot = bot
7 self.queues = {}
8
9 def get_queue(self, guild_id):
10 return self.queues.setdefault(guild_id, [])
11
12 @commands.slash_command(name="koleyjka", description="pokazuje koleyjke")
13 async def queue(self, ctx):
14 guild_id = ctx.guild.id
15 queue = self.get_queue(guild_id)
16 if queue:
17 queue_str = "\n".join(f"{i + 1}. {title}" for i, (_, title, _) in enumerate(queue))
18 await ctx.respond(f"koleyjka:\n{queue_str}")
19 else:
20 await ctx.respond("koleyjka jest pustawa")
21
22
23def setup(bot):
24 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 @@
1from discord.ext import commands
2
3
4class Skip(commands.Cog):
5 def __init__(self, bot):
6 self.bot = bot
7
8 @commands.slash_command(name="pomiń", description="przeskocz do nastepnej melodyji")
9 async def pomin(self, ctx):
10 """Skip the current song and play the next one in the queue."""
11 vc = ctx.voice_client
12
13 if not vc or not vc.is_connected():
14 await ctx.respond("Nie jestem połączony z kanałem głosowym.")
15 return
16
17 if not vc.is_playing() and not vc.is_paused():
18 await ctx.respond("Nic nie jest teraz odtwarzane.")
19 return
20
21 # Get the play cog
22 play_cog = self.bot.get_cog('Play')
23 if not play_cog:
24 await ctx.respond("Błąd: Nie można znaleźć modułu odtwarzania.")
25 return
26
27 queue = play_cog.get_queue(ctx.guild.id)
28
29 if not queue:
30 await ctx.respond("Kolejka jest pusta.")
31 return
32
33 # Stop the current song (this will trigger play_next in the after callback)
34 vc.stop()
35 await ctx.respond("Pominięto aktualną piosenkę.")
36
37 @commands.slash_command(name="kolejka", description="pokaż aktualną kolejkę")
38 async def queue_list(self, ctx):
39 """Show the current queue."""
40 play_cog = self.bot.get_cog('Play')
41 if not play_cog:
42 await ctx.respond("Błąd: Nie można znaleźć modułu odtwarzania.")
43 return
44
45 queue = play_cog.get_queue(ctx.guild.id)
46
47 if not queue:
48 await ctx.respond("Kolejka jest pusta.")
49 return
50
51 queue_list = []
52 for i, (title, _) in enumerate(queue[:10], 1): # Show up to 10 songs
53 queue_list.append(f"{i}. {title}")
54
55 if len(queue) > 10:
56 queue_list.append(f"...i {len(queue) - 10} więcej")
57
58 await ctx.respond("\n".join(["**Kolejka:**"] + queue_list))
59
60
61def setup(bot):
62 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 @@
1from discord.ext import commands
2
3
4class Stop(commands.Cog):
5 def __init__(self, bot):
6 self.bot = bot
7
8 @commands.slash_command(name="stop", description="stopuj bota")
9 async def stop(self, ctx):
10 await ctx.voice_client.disconnect()
11
12
13def setup(bot):
14 bot.add_cog(Stop(bot))