Skip to content

Commit

Permalink
[WarnSystem] Change permissions
Browse files Browse the repository at this point in the history
Do not limit commands to core mod and admin roles
  • Loading branch information
laggron42 committed Jul 24, 2020
1 parent b77eeaa commit f2e23b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion warnsystem/automod.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _format_embed_for_autowarn(
return embed

@commands.group()
@checks.admin()
@checks.admin_or_permissions(administrator=True)
async def automod(self, ctx: commands.Context):
"""
WarnSystem automod configuration.
Expand Down
16 changes: 11 additions & 5 deletions warnsystem/warnsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def __init__(self, bot):

self.task: asyncio.Task

__version__ = "1.3.6"
__version__ = "1.3.7"
__author__ = ["retke (El Laggron)"]

# helpers
Expand Down Expand Up @@ -787,7 +787,13 @@ async def warnings(
if not user:
await ctx.send_help()
return
if not await mod.is_mod_or_superior(self.bot, ctx.author) and user != ctx.author:
if (
not (
await mod.is_mod_or_superior(self.bot, ctx.author)
or ctx.author.guild_permissions.kick
)
and user != ctx.author
):
await ctx.send(_("You are not allowed to see other's warnings!"))
return
cases = await self.api.get_all_cases(ctx.guild, user)
Expand Down Expand Up @@ -1158,7 +1164,7 @@ async def delete_message(channel_id: int, message_id: int):
await message.edit(content=_("The case was successfully deleted!"), embed=None)

@commands.command()
@checks.mod()
@checks.mod_or_permissions(kick_members=True)
@commands.cooldown(1, 10, commands.BucketType.channel)
async def warnlist(self, ctx: commands.Context, short: bool = False):
"""
Expand Down Expand Up @@ -1202,7 +1208,7 @@ async def warnlist(self, ctx: commands.Context, short: bool = False):
await menus.menu(ctx=ctx, pages=pages, controls=menus.DEFAULT_CONTROLS, timeout=60)

@commands.command()
@checks.mod()
@checks.mod_or_permissions(manage_roles=True)
async def wsunmute(self, ctx: commands.Context, member: discord.Member):
"""
Unmute a member muted with WarnSystem.
Expand Down Expand Up @@ -1267,7 +1273,7 @@ async def wsunmute(self, ctx: commands.Context, member: discord.Member):
await ctx.send(page)

@commands.command()
@checks.mod()
@checks.mod_or_permissions(ban_members=True)
async def wsunban(self, ctx: commands.Context, member: UnavailableMember):
"""
Unban a member banned with WarnSystem.
Expand Down

0 comments on commit f2e23b5

Please sign in to comment.