From a58ac7cd2e43f24c502b472bd7a43fd1e99da58e Mon Sep 17 00:00:00 2001 From: Fixator10 Date: Wed, 19 May 2021 15:40:12 +0400 Subject: [PATCH] Change order of config calls in the Economy cog to only execute them when necessary. * Merge pull request #5002 --- redbot/cogs/economy/economy.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/redbot/cogs/economy/economy.py b/redbot/cogs/economy/economy.py index 39db1c9d2..6105ecdfa 100644 --- a/redbot/cogs/economy/economy.py +++ b/redbot/cogs/economy/economy.py @@ -90,7 +90,7 @@ def guild_only_check(): async def pred(ctx: commands.Context): if await bank.is_global(): return True - elif not await bank.is_global() and ctx.guild is not None: + elif ctx.guild is not None and not await bank.is_global(): return True else: return False @@ -415,8 +415,7 @@ class Economy(commands.Cog): - `` The user to delete the bank of. Takes mentions, names, and user ids. - `` This will default to false unless specified. """ - global_bank = await bank.is_global() - if global_bank is False and ctx.guild is None: + if ctx.guild is None and not await bank.is_global(): return await ctx.send(_("This command cannot be used in DMs with a local bank.")) try: name = member_or_id.display_name @@ -580,7 +579,7 @@ class Economy(commands.Cog): top = 10 base_embed = discord.Embed(title=_("Economy Leaderboard")) - if await bank.is_global() and show_global: + if show_global and await bank.is_global(): # show_global is only applicable if bank is global bank_sorted = await bank.get_leaderboard(positions=top, guild=None) base_embed.set_author(name=ctx.bot.user.name, icon_url=ctx.bot.user.avatar_url)