[Audio] Fix config set in shuffle and repeat commands (#2812)

Resolves #2811 and also the same thing in repeat command.
This commit is contained in:
PredaaA 2019-06-29 17:28:29 +02:00 committed by Toby Harradine
parent 03fe3ee720
commit 2f8b1a21c7

View File

@ -2819,9 +2819,6 @@ class Audio(commands.Cog):
ctx, ctx.author ctx, ctx.author
): ):
return await self._embed_msg(ctx, _("You need the DJ role to toggle repeat.")) return await self._embed_msg(ctx, _("You need the DJ role to toggle repeat."))
repeat = await self.config.guild(ctx.guild).repeat()
await self.config.guild(ctx.guild).repeat.set(not repeat)
repeat = await self.config.guild(ctx.guild).repeat()
if self._player_check(ctx): if self._player_check(ctx):
await self._data_check(ctx) await self._data_check(ctx)
player = lavalink.get_player(ctx.guild.id) player = lavalink.get_player(ctx.guild.id)
@ -2831,9 +2828,13 @@ class Audio(commands.Cog):
return await self._embed_msg( return await self._embed_msg(
ctx, _("You must be in the voice channel to toggle repeat.") ctx, _("You must be in the voice channel to toggle repeat.")
) )
repeat = await self.config.guild(ctx.guild).repeat()
await self.config.guild(ctx.guild).repeat.set(not repeat)
await self._embed_msg( await self._embed_msg(
ctx, _("Repeat tracks: {true_or_false}.").format(true_or_false=repeat) ctx, _("Repeat tracks: {true_or_false}.").format(true_or_false=not repeat)
) )
await self._data_check(ctx)
@commands.command() @commands.command()
@commands.guild_only() @commands.guild_only()
@ -3245,9 +3246,6 @@ class Audio(commands.Cog):
if dj_enabled: if dj_enabled:
if not await self._can_instaskip(ctx, ctx.author): if not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(ctx, _("You need the DJ role to toggle shuffle.")) return await self._embed_msg(ctx, _("You need the DJ role to toggle shuffle."))
shuffle = await self.config.guild(ctx.guild).shuffle()
await self.config.guild(ctx.guild).shuffle.set(not shuffle)
shuffle = await self.config.guild(ctx.guild).shuffle()
if self._player_check(ctx): if self._player_check(ctx):
await self._data_check(ctx) await self._data_check(ctx)
player = lavalink.get_player(ctx.guild.id) player = lavalink.get_player(ctx.guild.id)
@ -3257,9 +3255,13 @@ class Audio(commands.Cog):
return await self._embed_msg( return await self._embed_msg(
ctx, _("You must be in the voice channel to toggle shuffle.") ctx, _("You must be in the voice channel to toggle shuffle.")
) )
shuffle = await self.config.guild(ctx.guild).shuffle()
await self.config.guild(ctx.guild).shuffle.set(not shuffle)
await self._embed_msg( await self._embed_msg(
ctx, _("Shuffle tracks: {true_or_false}.").format(true_or_false=shuffle) ctx, _("Shuffle tracks: {true_or_false}.").format(true_or_false=not shuffle)
) )
await self._data_check(ctx)
@commands.command() @commands.command()
@commands.guild_only() @commands.guild_only()