Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 49 additions & 1 deletion cogs/music.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,52 @@ async def autoplay(self, interaction: discord.Interaction) -> None:
),
)

@app_commands.command(
name="loop",
description="Cambia el modo de repetición: off / track / queue",
)
@app_commands.describe(mode="off = sin repetición, track = repetir canción, queue = repetir cola")
@app_commands.choices(mode=[
app_commands.Choice(name="Off — reproducción normal", value="off"),
app_commands.Choice(name="Track — repite la canción actual", value="track"),
app_commands.Choice(name="Queue — repite toda la cola", value="queue"),
])
async def loop(self, interaction: discord.Interaction, mode: str):
"""Cambiar modo de loop: off / track / queue"""
try:
player, error_message = self._require_control_player(interaction)
if player is None:
return await self._send_error(interaction, error_message)

loop_map = {
"off": (lavalink.DefaultPlayer.LOOP_NONE, "Off", BOT_PRIMARY),
"track": (lavalink.DefaultPlayer.LOOP_SINGLE, "Track", BOT_SUCCESS),
"queue": (lavalink.DefaultPlayer.LOOP_QUEUE, "Queue", BOT_SUCCESS),
}
Comment on lines +1148 to +1152
loop_val, label, color = loop_map[mode]

player.set_loop(loop_val)
print(f"[LOOP] guild={interaction.guild.id} modo={label}")

descriptions = {
"off": "Reproducción normal — la cola avanza secuencialmente.",
"track": "🔂 Repitiendo la canción actual infinitamente.",
"queue": "🔁 Cuando la cola termine, vuelve a empezar desde el principio.",
}

await self._send_embed(
interaction,
self._build_embed(
interaction,
f"Loop: {label}",
descriptions[mode],
color=color,
),
)
except Exception as e:
print(f"[LOOP] ✗ Error: {e}")
await self._send_error(interaction, f"Error: {e}")

@app_commands.command(
name="play", description="Reproduce una canción (nombre o URL)"
)
Expand Down Expand Up @@ -1456,9 +1502,11 @@ async def nowplaying(self, interaction: discord.Interaction):
embed.add_field(
name="Autor", value=track.author or "Desconocido", inline=True
)
loop_label = {0: "", 1: " 🔂 Loop track", 2: " 🔁 Loop queue"}.get(player.loop, "")
status = ("En vivo" if track.is_stream else "En reproducción") + loop_label
Comment on lines +1505 to +1506
embed.add_field(
name="Estado",
value="En vivo" if track.is_stream else "En reproducción",
value=status,
inline=True,
)
embed.add_field(name="Duración", value=duration_label, inline=True)
Expand Down