Make checks in Bank, Economy and Trivia cogs Permissions-friendly (#3672)

* Create converters.py

* Update trivia.py

* Create checks.py

* Update checks.py

* Update checks.py

* Update trivia.py

* Update checks.py

* Update checks.py

* Update trivia.py

* Update bank.py

* Update economy.py

* Update trivia.py

* Update checks.py

* Update checks.py

* Update __init__.py
This commit is contained in:
jack1142
2020-03-28 23:24:12 +01:00
committed by GitHub
parent fce8186759
commit 97d77f5c51
6 changed files with 81 additions and 73 deletions

View File

@@ -7,7 +7,7 @@ from typing import cast, Iterable, Union
import discord
from redbot.cogs.bank import check_global_setting_guildowner, check_global_setting_admin
from redbot.cogs.bank import is_owner_if_bank_global
from redbot.cogs.mod.converters import RawUserIds
from redbot.core import Config, bank, commands, errors, checks
from redbot.core.i18n import Translator, cog_i18n
@@ -191,8 +191,9 @@ class Economy(commands.Cog):
)
)
@is_owner_if_bank_global()
@checks.admin_or_permissions(manage_guild=True)
@_bank.command(name="set")
@check_global_setting_admin()
async def _set(self, ctx: commands.Context, to: discord.Member, creds: SetParser):
"""Set the balance of user's bank account.
@@ -236,8 +237,9 @@ class Economy(commands.Cog):
else:
await ctx.send(msg)
@is_owner_if_bank_global()
@checks.guildowner_or_permissions(administrator=True)
@_bank.command()
@check_global_setting_guildowner()
async def reset(self, ctx, confirmation: bool = False):
"""Delete all bank accounts."""
if confirmation is False:
@@ -258,8 +260,9 @@ class Economy(commands.Cog):
)
)
@is_owner_if_bank_global()
@checks.admin_or_permissions(manage_guild=True)
@_bank.group(name="prune")
@check_global_setting_admin()
async def _prune(self, ctx):
"""Prune bank accounts."""
pass
@@ -646,9 +649,10 @@ class Economy(commands.Cog):
)
)
@commands.group()
@guild_only_check()
@check_global_setting_admin()
@is_owner_if_bank_global()
@checks.admin_or_permissions(manage_guild=True)
@commands.group()
async def economyset(self, ctx: commands.Context):
"""Manage Economy settings."""
guild = ctx.guild