From 1dc318479373713a0ea9a00de90324f5df548bd4 Mon Sep 17 00:00:00 2001 From: eip <36315290+eip618@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:40:01 +1100 Subject: [PATCH] change soap perms, add soap_check with extra squish --- cogs/assistance.py | 6 +++--- utils/checks.py | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cogs/assistance.py b/cogs/assistance.py index 742fd1509..7c298f357 100644 --- a/cogs/assistance.py +++ b/cogs/assistance.py @@ -7,7 +7,7 @@ from discord.ext import commands from os.path import dirname, join from typing import Optional, Literal, TYPE_CHECKING -from utils.checks import check_if_user_can_sr, is_staff +from utils.checks import check_if_user_can_sr, is_staff, soap_check from utils.mdcmd import add_md_files_as_commands from utils.views import BasePaginator, PaginatedEmbedView from utils.utils import KurisuCooldown @@ -128,11 +128,11 @@ async def createsmallhelp(self, ctx: GuildContext, console: Literal['3ds', 'swit await self.bot.channels['mod-logs'].send(msg) await ctx.send(f"Created small help {channel.mention}.") - @is_staff('Helper') + @soap_check() @commands.guild_only() @commands.command(aliases=["soup", "soap"]) async def createsoap(self, ctx: GuildContext, helpee: discord.Member): - """Creates a 🧼 help channel for a user. Helper+ only.""" + """Creates a 🧼 help channel for a user. crc, small help, helper+ only.""" if not self.soaps_category: return await ctx.send("The soaps category is not set.") # Channel names can't be longer than 100 characters diff --git a/utils/checks.py b/utils/checks.py index 9b60b832f..bc1a6980b 100644 --- a/utils/checks.py +++ b/utils/checks.py @@ -65,6 +65,17 @@ async def predicate(ctx): return commands.check(predicate) +def soap_check(): + async def predicate(ctx): + author = ctx.author + if not check_staff(ctx.bot, 'Helper', author.id) and check_staff(ctx.bot, 'Staff', author.id) and ( + ctx.bot.roles['crc'] not in author.roles) and (ctx.bot.roles['Small Help'] not in author.roles): + return False + return True + + return commands.check(predicate) + + def check_if_user_can_ready(): async def predicate(ctx): channel = ctx.channel