Cleanup [p]volume and fix infinite retrying in autoplay (#5045)

* This PR depends on Part 2 due to new store value

- cleanup of [p]volume
- a fix for infinite retrying

* update `[p]volume` help

* Update controller.py

* Update redbot/cogs/audio/core/commands/controller.py

meh still hardcoded in RLL .. will be removed in 0.9

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/audio/core/commands/controller.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Draper 2021-05-17 10:38:30 +01:00 committed by GitHub
parent 54e5307307
commit 1efcabada1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 19 deletions

View File

@ -710,7 +710,7 @@ class PlayerControllerCommands(MixinMeta, metaclass=CompositeMetaClass):
can_skip = await self._can_instaskip(ctx, ctx.author) can_skip = await self._can_instaskip(ctx, ctx.author)
if not vol: if not vol:
vol = await self.config.guild(ctx.guild).volume() vol = await self.config.guild(ctx.guild).volume()
embed = discord.Embed(title=_("Current Volume:"), description=str(vol) + "%") embed = discord.Embed(title=_("Current Volume:"), description=f"{vol}%")
if not self._player_check(ctx): if not self._player_check(ctx):
embed.set_footer(text=_("Nothing playing.")) embed.set_footer(text=_("Nothing playing."))
return await self.send_embed_msg(ctx, embed=embed) return await self.send_embed_msg(ctx, embed=embed)
@ -733,17 +733,7 @@ class PlayerControllerCommands(MixinMeta, metaclass=CompositeMetaClass):
description=_("You need the DJ role to change the volume."), description=_("You need the DJ role to change the volume."),
) )
if vol < 0: vol = max(0, min(vol, 150))
vol = 0
if vol > 150:
vol = 150
await self.config.guild(ctx.guild).volume.set(vol)
if self._player_check(ctx):
player = lavalink.get_player(ctx.guild.id)
await player.set_volume(vol)
player.store("channel", ctx.channel.id)
player.store("guild", ctx.guild.id)
else:
await self.config.guild(ctx.guild).volume.set(vol) await self.config.guild(ctx.guild).volume.set(vol)
if self._player_check(ctx): if self._player_check(ctx):
player = lavalink.get_player(ctx.guild.id) player = lavalink.get_player(ctx.guild.id)
@ -751,7 +741,7 @@ class PlayerControllerCommands(MixinMeta, metaclass=CompositeMetaClass):
player.store("channel", ctx.channel.id) player.store("channel", ctx.channel.id)
player.store("guild", ctx.guild.id) player.store("guild", ctx.guild.id)
embed = discord.Embed(title=_("Volume:"), description=str(vol) + "%") embed = discord.Embed(title=_("Volume:"), description=f"{vol}%")
if not self._player_check(ctx): if not self._player_check(ctx):
embed.set_footer(text=_("Nothing playing.")) embed.set_footer(text=_("Nothing playing."))
await self.send_embed_msg(ctx, embed=embed) await self.send_embed_msg(ctx, embed=embed)

View File

@ -200,6 +200,7 @@ class AudioEvents(MixinMeta, metaclass=CompositeMetaClass):
await asyncio.sleep(0.1) await asyncio.sleep(0.1)
if tries > 1000: if tries > 1000:
return return
tries += 1
if notify_channel and not player.fetch("autoplay_notified", False): if notify_channel and not player.fetch("autoplay_notified", False):
if ( if (