aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cogs/music/queue.py24
-rw-r--r--cogs/music/skip.py62
-rw-r--r--cogs/music/stop.py14
-rw-r--r--main.py5
4 files changed, 16 insertions, 89 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))
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():
20if __name__ == "__main__": 20if __name__ == "__main__":
21 load_dotenv() 21 load_dotenv()
22 extensions = [ 22 extensions = [
23 "cogs.vc_logs", 23 "cogs.vclogs",
24 "cogs.compression", 24 "cogs.compression",
25 'cogs.tts', 25 'cogs.tts',
26 'cogs.web', 26 'cogs.web',
@@ -29,8 +29,7 @@ if __name__ == "__main__":
29 'cogs.downloader', 29 'cogs.downloader',
30 'cogs.music.play', 30 'cogs.music.play',
31 'cogs.music.play_compressed', 31 'cogs.music.play_compressed',
32 'cogs.music.skip', 32 'cogs.music.stop',
33 'cogs.music.queue',
34 'cogs.music.join', 33 'cogs.music.join',
35 'cogs.music.leave', 34 'cogs.music.leave',
36 ] 35 ]