Remove create_progress_bar method from ExtendedAudio cog and update duration display logic to simplify track information presentation. The progress bar is no longer shown, but duration formatting remains intact.
Some checks are pending
Run pre-commit / Run pre-commit (push) Waiting to run

This commit is contained in:
Valerie 2025-05-28 02:28:35 -04:00
parent 640a9cf7af
commit 1d5b7783dd

View file

@ -196,14 +196,6 @@ class ExtendedAudio(commands.Cog):
else: else:
return f"{minutes}:{seconds % 60:02d}" return f"{minutes}:{seconds % 60:02d}"
def create_progress_bar(self, current: int, total: int, length: int = 20) -> str:
"""Create a text progress bar."""
filled = int((current / total) * length)
bar = "" * filled + "" * (length - filled)
current_time = self.format_duration(current)
total_time = self.format_duration(total)
return f"{current_time} {bar} {total_time}"
@commands.Cog.listener() @commands.Cog.listener()
async def on_red_audio_track_start(self, guild: discord.Guild, track: dict, requester: discord.Member): async def on_red_audio_track_start(self, guild: discord.Guild, track: dict, requester: discord.Member):
"""Post song information when a new track starts""" """Post song information when a new track starts"""
@ -243,12 +235,8 @@ class ExtendedAudio(commands.Cog):
embed.add_field(name="Requested By", value=requester.mention, inline=True) embed.add_field(name="Requested By", value=requester.mention, inline=True)
# Add duration/progress # Add duration
if guild_settings["show_progress"] and hasattr(track, "length"): if hasattr(track, "length"):
duration = track.length
progress_bar = self.create_progress_bar(0, duration)
embed.add_field(name="Duration", value=progress_bar, inline=False)
elif hasattr(track, "length"):
embed.add_field( embed.add_field(
name="Duration", name="Duration",
value=self.format_duration(track.length), value=self.format_duration(track.length),