Fix bank check (used in Bank, Economy and Trivia cogs)

This commit is contained in:
jack1142 2020-04-05 03:49:02 +02:00 committed by GitHub
parent be7d1d2cd2
commit 20d507dbef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,8 @@ _ = Translator("Bank", __file__)
def is_owner_if_bank_global():
"""
Command decorator. If the bank is global, it checks if the author is
bot owner, otherwise it does nothing.
bot owner, otherwise it only checks
if command was used in guild - it DOES NOT check any permissions.
When used on the command, this should be combined
with permissions check like `guildowner_or_permissions()`.
@ -21,12 +22,9 @@ def is_owner_if_bank_global():
async def pred(ctx: commands.Context):
author = ctx.author
if not await bank.is_global():
if not isinstance(ctx.channel, discord.abc.GuildChannel):
if not ctx.guild:
return False
if await ctx.bot.is_owner(author):
return True
permissions = ctx.channel.permissions_for(author)
return author == ctx.guild.owner or permissions.administrator
else:
return await ctx.bot.is_owner(author)