Skip to content
Open
Show file tree
Hide file tree
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
46 changes: 46 additions & 0 deletions redbot/cogs/audio/core/commands/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ async def command_now(self, ctx: commands.Context):
+ ": "
+ ("\N{WHITE HEAVY CHECK MARK}" if repeat else "\N{CROSS MARK}")
)
text += (
(" | " if text else "")
+ _("Repeat Current")
+ ": "
+ ("\N{WHITE HEAVY CHECK MARK}" if player.repeat_current else "\N{CROSS MARK}")
)

message = await self.send_embed_msg(ctx, embed=embed, footer=text)

Expand Down Expand Up @@ -784,6 +790,46 @@ async def command_repeat(self, ctx: commands.Context):
if self._player_check(ctx):
await self.set_player_settings(ctx)

@commands.command(name="repeatcurrent")
@commands.guild_only()
@commands.bot_has_permissions(embed_links=True)
async def command_repeat_current(self, ctx: commands.Context):
"""Toggle repeat current."""
dj_enabled = self._dj_status_cache.setdefault(
ctx.guild.id, await self.config.guild(ctx.guild).dj_enabled()
)
can_skip = await self._can_instaskip(ctx, ctx.author)
if dj_enabled and not can_skip and not await self._has_dj_role(ctx, ctx.author):
return await self.send_embed_msg(
ctx,
title=_("Unable To Toggle Repeat Current"),
description=_("You need the DJ role to toggle repeat current."),
)
if not self._player_check(ctx):
return await self.send_embed_msg(
ctx,
title=_("Unable To Toggle Repeat Current"),
description=_("Nothing playing."),
)

await self.set_player_settings(ctx)
player = lavalink.get_player(ctx.guild.id)
if (not ctx.author.voice or ctx.author.voice.channel != player.channel) and not can_skip:
return await self.send_embed_msg(
ctx,
title=_("Unable To Toggle Repeat Current"),
description=_("You must be in the voice channel to toggle repeat current."),
)
player.store("notify_channel", ctx.channel.id)

msg = _("Repeat current track: {true_or_false}.").format(
true_or_false=_("Enabled") if not player.repeat_current else _("Disabled")
)
player.repeat_current = not player.repeat_current

embed = discord.Embed(title=_("Setting Changed"), description=msg)
await self.send_embed_msg(ctx, embed=embed)

@commands.command(name="remove")
@commands.guild_only()
@commands.bot_has_permissions(embed_links=True)
Expand Down
6 changes: 6 additions & 0 deletions redbot/cogs/audio/core/commands/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ async def _queue_menu(
+ ": "
+ ("\N{WHITE HEAVY CHECK MARK}" if repeat else "\N{CROSS MARK}")
)
text += (
(" | " if text else "")
+ _("Repeat Current")
+ ": "
+ ("\N{WHITE HEAVY CHECK MARK}" if player.repeat_current else "\N{CROSS MARK}")
)
embed.set_footer(text=text)
message = await self.send_embed_msg(ctx, embed=embed)
dj_enabled = self._dj_status_cache.setdefault(ctx.guild.id, guild_data["dj_enabled"])
Expand Down
1 change: 1 addition & 0 deletions redbot/cogs/audio/core/utilities/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ async def is_requester(self, ctx: commands.Context, member: discord.Member) -> b

async def _skip_action(self, ctx: commands.Context, skip_to_track: int = None) -> None:
player = lavalink.get_player(ctx.guild.id)
player.repeat_current = False
autoplay = await self.config.guild(player.guild).auto_play()
if not player.current or (not player.queue and not autoplay):
try:
Expand Down
6 changes: 6 additions & 0 deletions redbot/cogs/audio/core/utilities/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ async def _build_queue_page(
+ ": "
+ ("\N{WHITE HEAVY CHECK MARK}" if repeat else "\N{CROSS MARK}")
)
text += (
(" | " if text else "")
+ _("Repeat Current")
+ ": "
+ ("\N{WHITE HEAVY CHECK MARK}" if player.repeat_current else "\N{CROSS MARK}")
)
embed.set_footer(text=text)
return embed

Expand Down
Loading