chore: default volume to 100%, translate discord logs to Polish, rename project to ŻyrarBOT

This commit is contained in:
mmacierzanka committed 2026-05-23 14:37:16 +02:00
1 parent 71800c8fd5
commit 07e32c1a1d
5 files changed
+61 -61

No files matched your search

+49 -49
View File
@@ -17,7 +17,7 @@ class MusicBot(commands.Cog):
self.bot = bot
self.queue = []
self.current = None
self.volume = 0.5
self.volume = 1.0 # Domyślna głośność ustawiona na 100% (1.0)
self.loop_current = False
self.last_channel = None
@@ -68,7 +68,7 @@ class MusicBot(commands.Cog):
async def ensure_voice(self, interaction):
if not interaction.user.voice:
await interaction.response.send_message(
"You are not connected to a voice channel",
"Nie jesteś połączony z kanałem głosowym.",
ephemeral=True
)
return False
@@ -77,17 +77,17 @@ class MusicBot(commands.Cog):
await interaction.user.voice.channel.connect()
elif interaction.guild.voice_client.channel != interaction.user.voice.channel:
await interaction.response.send_message(
"I'm already in another voice channel",
"Jestem już połączony z innym kanałem głosowym.",
ephemeral=True
)
return False
return True
@app_commands.command(name="play", description="Play a song from YouTube")
@app_commands.describe(query="YouTube URL or search query")
@app_commands.command(name="play", description="Odtwórz utwór z YouTube")
@app_commands.describe(query="Link YouTube lub zapytanie wyszukiwania")
async def play(self, interaction: discord.Interaction, query: str):
"""Play a song from YouTube"""
"""Odtwórz utwór z YouTube"""
if not await self.ensure_voice(interaction):
return
@@ -100,7 +100,7 @@ class MusicBot(commands.Cog):
if interaction.guild.voice_client.is_playing():
self.queue.append(player)
await interaction.followup.send(
f"Added to queue: {player.title}",
f"Dodano do kolejki: {player.title}",
ephemeral=False
)
else:
@@ -113,12 +113,12 @@ class MusicBot(commands.Cog):
)
)
await interaction.followup.send(
f"Now playing: {player.title}",
f"Teraz odtwarzane: {player.title}",
ephemeral=False
)
except Exception as e:
await interaction.followup.send(
f"An error occurred: {e}",
f"Wystąpił błąd: {e}",
ephemeral=True
)
@@ -140,7 +140,7 @@ class MusicBot(commands.Cog):
self.bot.loop
)
)
await self.send_to_last_channel(f"Now playing (looped): {self.current.title}")
await self.send_to_last_channel(f"Teraz odtwarzane (zapętlone): {self.current.title}")
return
except Exception as e:
print(f"Error repeating song: {e}")
@@ -154,10 +154,10 @@ class MusicBot(commands.Cog):
self.bot.loop
)
)
await self.send_to_last_channel(f"Now playing: {self.current.title}")
await self.send_to_last_channel(f"Teraz odtwarzane: {self.current.title}")
else:
self.current = None
await self.send_to_last_channel("Queue is empty")
await self.send_to_last_channel("Kolejka jest pusta.")
async def send_to_last_channel(self, text):
channel = self.get_notification_channel()
@@ -167,86 +167,86 @@ class MusicBot(commands.Cog):
except Exception as e:
print(f"Failed to send message: {e}")
@app_commands.command(name="queue", description="Show the current queue")
@app_commands.command(name="queue", description="Pokaż aktualną kolejkę")
async def show_queue(self, interaction: discord.Interaction):
"""Show the current queue"""
"""Pokaż aktualną kolejkę"""
if not self.queue:
await interaction.response.send_message(
"The queue is empty",
"Kolejka jest pusta.",
ephemeral=True
)
return
queue_list = "\n".join([f"{i + 1}. {item.title}" for i, item in enumerate(self.queue)])
await interaction.response.send_message(
f"Current queue:\n{queue_list}",
f"Aktualna kolejka:\n{queue_list}",
ephemeral=False
)
@app_commands.command(name="skip", description="Skip the current song")
@app_commands.command(name="skip", description="Pomiń aktualny utwór")
async def skip(self, interaction: discord.Interaction):
"""Skip the current song"""
"""Pomiń aktualny utwór"""
if interaction.guild.voice_client.is_playing():
interaction.guild.voice_client.stop()
await interaction.response.send_message(
"Skipped current song",
"Pominięto aktualny utwór.",
ephemeral=False
)
else:
await interaction.response.send_message(
"Not playing anything",
"Nic nie jest odtwarzane.",
ephemeral=True
)
@app_commands.command(name="pause", description="Pause the current song")
@app_commands.command(name="pause", description="Wstrzymaj odtwarzanie")
async def pause(self, interaction: discord.Interaction):
"""Pause the current song"""
"""Wstrzymaj odtwarzanie"""
if interaction.guild.voice_client.is_playing():
interaction.guild.voice_client.pause()
await interaction.response.send_message(
"Paused",
"Odtwarzanie wstrzymane.",
ephemeral=False
)
else:
await interaction.response.send_message(
"Not playing anything",
"Nic nie jest odtwarzane.",
ephemeral=True
)
@app_commands.command(name="resume", description="Resume the current song")
@app_commands.command(name="resume", description="Wznów odtwarzanie")
async def resume(self, interaction: discord.Interaction):
"""Resume the current song"""
"""Wznów odtwarzanie"""
if interaction.guild.voice_client.is_paused():
interaction.guild.voice_client.resume()
await interaction.response.send_message(
"Resumed",
"Odtwarzanie wznowione.",
ephemeral=False
)
else:
await interaction.response.send_message(
"Not paused",
"Odtwarzanie nie jest wstrzymane.",
ephemeral=True
)
@app_commands.command(name="stop", description="Stop playback and clear queue")
@app_commands.command(name="stop", description="Zatrzymaj odtwarzanie i wyczyść kolejkę")
async def stop(self, interaction: discord.Interaction):
"""Stop playback and clear queue"""
"""Zatrzymaj odtwarzanie i wyczyść kolejkę"""
if interaction.guild.voice_client.is_playing():
interaction.guild.voice_client.stop()
self.queue.clear()
self.current = None
await interaction.response.send_message(
"Stopped and cleared queue",
"Zatrzymano odtwarzanie i wyczyszczono kolejkę.",
ephemeral=False
)
@app_commands.command(name="volume", description="Change the player volume")
@app_commands.describe(volume="The volume level (1-100)")
@app_commands.command(name="volume", description="Zmień głośność odtwarzacza")
@app_commands.describe(volume="Poziom głośności (1-100)")
async def volume(self, interaction: discord.Interaction, volume: int):
"""Change the player volume"""
"""Zmień głośność odtwarzacza"""
if interaction.guild.voice_client is None:
return await interaction.response.send_message(
"Not connected to a voice channel",
"Nie połączono z kanałem głosowym.",
ephemeral=True
)
@@ -254,55 +254,55 @@ class MusicBot(commands.Cog):
self.volume = volume / 100
interaction.guild.voice_client.source.volume = self.volume
await interaction.response.send_message(
f"Changed volume to {volume}%",
f"Zmieniono głośność na {volume}%",
ephemeral=False
)
return None
else:
await interaction.response.send_message(
"Please enter a value between 1 and 100",
"Wprowadź wartość z przedziału od 1 do 100.",
ephemeral=True
)
return None
@app_commands.command(name="nowplaying", description="Show the currently playing song")
@app_commands.command(name="nowplaying", description="Pokaż aktualnie odtwarzany utwór")
async def now_playing(self, interaction: discord.Interaction):
"""Show the currently playing song"""
"""Pokaż aktualnie odtwarzany utwór"""
if self.current:
await interaction.response.send_message(
f"Now playing: {self.current.title}",
f"Teraz odtwarzane: {self.current.title}",
ephemeral=False
)
else:
await interaction.response.send_message(
"Nothing is currently playing",
"Nic nie jest obecnie odtwarzane.",
ephemeral=True
)
@app_commands.command(name="leave", description="Leave the voice channel")
@app_commands.command(name="leave", description="Odłącz bota od kanału głosowego")
async def leave(self, interaction: discord.Interaction):
"""Leave the voice channel"""
"""Odłącz bota od kanału głosowego"""
if interaction.guild.voice_client is not None:
await interaction.guild.voice_client.disconnect()
self.queue.clear()
self.current = None
await interaction.response.send_message(
"Left the voice channel",
"Rozłączono z kanału głosowego.",
ephemeral=False
)
else:
await interaction.response.send_message(
"I'm not in a voice channel",
"Nie jestem na kanale głosowym.",
ephemeral=True
)
@app_commands.command(name="loop", description="Toggle loop for the current song")
@app_commands.command(name="loop", description="Włącz/wyłącz zapętlanie aktualnego utworu")
async def loop_command(self, interaction: discord.Interaction):
"""Toggle loop for the current song"""
"""Włącz/wyłącz zapętlanie aktualnego utworu"""
self.loop_current = not self.loop_current
state = "enabled" if self.loop_current else "disabled"
state = "włączone" if self.loop_current else "wyłączone"
await interaction.response.send_message(
f"Looping for the current song is now {state}.",
f"Zapętlanie aktualnego utworu zostało {state}.",
ephemeral=False
)