Skip to content

Commit

Permalink
Fix bank check (used in Bank, Economy and Trivia cogs)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackenmen authored Apr 5, 2020
1 parent be7d1d2 commit 20d507d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions redbot/cogs/bank/bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@
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()`.
"""

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
return True
else:
return await ctx.bot.is_owner(author)

Expand Down

0 comments on commit 20d507d

Please sign in to comment.