From 9959bd3300c131624203a6325d38cfe91e0f7bc8 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 30 Dec 2024 04:01:35 -0500 Subject: [PATCH] fix(commands/voice/volume): check active player earlier --- commands/voice.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/commands/voice.py b/commands/voice.py index 902239d..108c3dd 100644 --- a/commands/voice.py +++ b/commands/voice.py @@ -173,6 +173,13 @@ async def volume(message): if not (args := await parser.parse_args(message, tokens)): return + if not message.guild.voice_client.source: + await utils.reply( + message, + f"there is no player currently active!", + ) + return + if args.volume: message.guild.voice_client.source.volume = float(args.volume) / 100.0 await utils.reply( @@ -180,16 +187,10 @@ async def volume(message): f"volume set to **{args.volume}%**", ) else: - if message.guild.voice_client.source: - await utils.reply( - message, - f"current volume is **{int(message.guild.voice_client.source.volume * 100)}%**", - ) - else: - await utils.reply( - message, - f"there is no player currently active!", - ) + await utils.reply( + message, + f"current volume is **{int(message.guild.voice_client.source.volume * 100)}%**", + ) async def play_next(message):