From 22a342d36d17edbbf26a642fc70b6bb84c6cfaa4 Mon Sep 17 00:00:00 2001 From: palmtree5 <3577255+palmtree5@users.noreply.github.com> Date: Mon, 12 Mar 2018 15:10:46 -0800 Subject: [PATCH] [V3 Bank/Economy] Fix #1404 and an issue with [p]bank reset (#1407) * [V3 Bank] fix an issue with checks * [V3 Economy] fix issues with [p]bank reset --- redbot/cogs/bank/bank.py | 6 ++++++ redbot/cogs/economy/economy.py | 15 +++------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/redbot/cogs/bank/bank.py b/redbot/cogs/bank/bank.py index b51f1c9ba..c42d9b276 100644 --- a/redbot/cogs/bank/bank.py +++ b/redbot/cogs/bank/bank.py @@ -1,3 +1,5 @@ +import discord + from redbot.core import checks, bank from redbot.core.i18n import CogI18n from discord.ext import commands @@ -17,6 +19,8 @@ def check_global_setting_guildowner(): if await ctx.bot.is_owner(author): return True if not await bank.is_global(): + if not isinstance(ctx.channel, discord.abc.GuildChannel): + return False permissions = ctx.channel.permissions_for(author) return author == ctx.guild.owner or permissions.administrator @@ -33,6 +37,8 @@ def check_global_setting_admin(): if await ctx.bot.is_owner(author): return True if not await bank.is_global(): + if not isinstance(ctx.channel, discord.abc.GuildChannel): + return False permissions = ctx.channel.permissions_for(author) is_guild_owner = author == ctx.guild.owner admin_role = await ctx.bot.db.guild(ctx.guild).admin_role() diff --git a/redbot/cogs/economy/economy.py b/redbot/cogs/economy/economy.py index c3772e288..6a0ddbd29 100644 --- a/redbot/cogs/economy/economy.py +++ b/redbot/cogs/economy/economy.py @@ -216,18 +216,9 @@ class Economy: ) ) else: - if await bank.is_global(): - # Bank being global means that the check would cause only - # the owner and any co-owners to be able to run the command - # so if we're in the function, it's safe to assume that the - # author is authorized to use owner-only commands - user = ctx.author - else: - user = ctx.guild.owner - success = await bank.wipe_bank() - if success: - await ctx.send(_("All bank accounts of this guild have been " - "deleted.")) + await bank.wipe_bank() + await ctx.send(_("All bank accounts of this guild have been " + "deleted.")) @commands.command() @guild_only_check()