diff options
| author | SamlonDev <stankiewiczgracjan2019@gmail.com> | 2025-06-14 18:54:02 +0200 |
|---|---|---|
| committer | SamlonDev <stankiewiczgracjan2019@gmail.com> | 2025-06-14 18:54:02 +0200 |
| commit | 791e75cb2beeca45a6edf52b65f7e299e03b5eaf (patch) | |
| tree | cfee93211b7f8ac1c985325aaf8d9399b7a357ca /cogs/music/skip.py | |
| parent | temp downloads the files instead (diff) | |
| download | senator-sperma-791e75cb2beeca45a6edf52b65f7e299e03b5eaf.tar.gz senator-sperma-791e75cb2beeca45a6edf52b65f7e299e03b5eaf.zip | |
code-style issues
Diffstat (limited to 'cogs/music/skip.py')
| -rw-r--r-- | cogs/music/skip.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/cogs/music/skip.py b/cogs/music/skip.py index 67c391e..b0023fe 100644 --- a/cogs/music/skip.py +++ b/cogs/music/skip.py | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | from discord.ext import commands | 1 | from discord.ext import commands |
| 2 | import discord | 2 | |
| 3 | 3 | ||
| 4 | class Skip(commands.Cog): | 4 | class Skip(commands.Cog): |
| 5 | def __init__(self, bot): | 5 | def __init__(self, bot): |
| @@ -9,31 +9,31 @@ class Skip(commands.Cog): | |||
| 9 | async def pomin(self, ctx): | 9 | async def pomin(self, ctx): |
| 10 | """Skip the current song and play the next one in the queue.""" | 10 | """Skip the current song and play the next one in the queue.""" |
| 11 | vc = ctx.voice_client | 11 | vc = ctx.voice_client |
| 12 | 12 | ||
| 13 | if not vc or not vc.is_connected(): | 13 | if not vc or not vc.is_connected(): |
| 14 | await ctx.respond("Nie jestem połączony z kanałem głosowym.") | 14 | await ctx.respond("Nie jestem połączony z kanałem głosowym.") |
| 15 | return | 15 | return |
| 16 | 16 | ||
| 17 | if not vc.is_playing() and not vc.is_paused(): | 17 | if not vc.is_playing() and not vc.is_paused(): |
| 18 | await ctx.respond("Nic nie jest teraz odtwarzane.") | 18 | await ctx.respond("Nic nie jest teraz odtwarzane.") |
| 19 | return | 19 | return |
| 20 | 20 | ||
| 21 | # Get the play cog | 21 | # Get the play cog |
| 22 | play_cog = self.bot.get_cog('Play') | 22 | play_cog = self.bot.get_cog('Play') |
| 23 | if not play_cog: | 23 | if not play_cog: |
| 24 | await ctx.respond("Błąd: Nie można znaleźć modułu odtwarzania.") | 24 | await ctx.respond("Błąd: Nie można znaleźć modułu odtwarzania.") |
| 25 | return | 25 | return |
| 26 | 26 | ||
| 27 | queue = play_cog.get_queue(ctx.guild.id) | 27 | queue = play_cog.get_queue(ctx.guild.id) |
| 28 | 28 | ||
| 29 | if not queue: | 29 | if not queue: |
| 30 | await ctx.respond("Kolejka jest pusta.") | 30 | await ctx.respond("Kolejka jest pusta.") |
| 31 | return | 31 | return |
| 32 | 32 | ||
| 33 | # Stop the current song (this will trigger play_next in the after callback) | 33 | # Stop the current song (this will trigger play_next in the after callback) |
| 34 | vc.stop() | 34 | vc.stop() |
| 35 | await ctx.respond("Pominięto aktualną piosenkę.") | 35 | await ctx.respond("Pominięto aktualną piosenkę.") |
| 36 | 36 | ||
| 37 | @commands.slash_command(name="kolejka", description="pokaż aktualną kolejkę") | 37 | @commands.slash_command(name="kolejka", description="pokaż aktualną kolejkę") |
| 38 | async def queue_list(self, ctx): | 38 | async def queue_list(self, ctx): |
| 39 | """Show the current queue.""" | 39 | """Show the current queue.""" |
| @@ -41,21 +41,22 @@ class Skip(commands.Cog): | |||
| 41 | if not play_cog: | 41 | if not play_cog: |
| 42 | await ctx.respond("Błąd: Nie można znaleźć modułu odtwarzania.") | 42 | await ctx.respond("Błąd: Nie można znaleźć modułu odtwarzania.") |
| 43 | return | 43 | return |
| 44 | 44 | ||
| 45 | queue = play_cog.get_queue(ctx.guild.id) | 45 | queue = play_cog.get_queue(ctx.guild.id) |
| 46 | 46 | ||
| 47 | if not queue: | 47 | if not queue: |
| 48 | await ctx.respond("Kolejka jest pusta.") | 48 | await ctx.respond("Kolejka jest pusta.") |
| 49 | return | 49 | return |
| 50 | 50 | ||
| 51 | queue_list = [] | 51 | queue_list = [] |
| 52 | for i, (title, _) in enumerate(queue[:10], 1): # Show up to 10 songs | 52 | for i, (title, _) in enumerate(queue[:10], 1): # Show up to 10 songs |
| 53 | queue_list.append(f"{i}. {title}") | 53 | queue_list.append(f"{i}. {title}") |
| 54 | 54 | ||
| 55 | if len(queue) > 10: | 55 | if len(queue) > 10: |
| 56 | queue_list.append(f"...i {len(queue) - 10} więcej") | 56 | queue_list.append(f"...i {len(queue) - 10} więcej") |
| 57 | 57 | ||
| 58 | await ctx.respond("\n".join(["**Kolejka:**"] + queue_list)) | 58 | await ctx.respond("\n".join(["**Kolejka:**"] + queue_list)) |
| 59 | 59 | ||
| 60 | |||
| 60 | def setup(bot): | 61 | def setup(bot): |
| 61 | bot.add_cog(Skip(bot)) \ No newline at end of file | 62 | bot.add_cog(Skip(bot)) |
