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
Some checks are pending
Run pre-commit / Run pre-commit (push) Waiting to run
This commit is contained in:
parent
640a9cf7af
commit
1d5b7783dd
1 changed files with 2 additions and 14 deletions
|
@ -196,14 +196,6 @@ class ExtendedAudio(commands.Cog):
|
|||
else:
|
||||
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()
|
||||
async def on_red_audio_track_start(self, guild: discord.Guild, track: dict, requester: discord.Member):
|
||||
"""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)
|
||||
|
||||
# Add duration/progress
|
||||
if guild_settings["show_progress"] and 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"):
|
||||
# Add duration
|
||||
if hasattr(track, "length"):
|
||||
embed.add_field(
|
||||
name="Duration",
|
||||
value=self.format_duration(track.length),
|
||||
|
|
Loading…
Add table
Reference in a new issue