audio: split into more modules

This commit is contained in:
2025-02-09 03:05:44 -05:00
parent af0896a6a0
commit 69f4d6967f
10 changed files with 234 additions and 217 deletions

View File

@@ -16,7 +16,7 @@ from .utils import command_allowed, ensure_joined, play_next
async def queue_or_play(message, edited=False):
if message.guild.id not in players:
players[message.guild.id] = audio.QueuedPlayer()
players[message.guild.id] = audio.queue.Player()
tokens = commands.tokenize(message.content)
parser = arguments.ArgumentParser(
@@ -154,7 +154,7 @@ async def queue_or_play(message, edited=False):
try:
async with message.channel.typing():
player = await audio.YTDLSource.from_url(
player = await audio.youtubedl.YTDLSource.from_url(
" ".join(query), loop=client.loop, stream=True
)
player.volume = float(args.volume) / 100.0
@@ -162,7 +162,7 @@ async def queue_or_play(message, edited=False):
await utils.reply(message, f"**failed to queue:** `{e}`")
return
queued = audio.QueuedSong(player, message)
queued = audio.queue.Song(player, message)
if args.now or args.next:
players[message.guild.id].queue_add_front(queued)

View File

@@ -32,7 +32,7 @@ async def sponsorblock_command(message):
current = "**" if progress >= begin and progress < end else ""
text.append(
f"{current}`{audio.format_duration(begin)}` - `{audio.format_duration(end)}`: {category_name if category_name else 'Unknown'}{current}"
f"{current}`{audio.utils.format_duration(begin)}` - `{audio.utils.format_duration(end)}`: {category_name if category_name else 'Unknown'}{current}"
)
await utils.reply(