Skip to content

Commit

Permalink
possibly fix wii restriction commands?
Browse files Browse the repository at this point in the history
  • Loading branch information
eip618 committed Mar 10, 2024
1 parent 1dc3184 commit 71c08ba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
8 changes: 3 additions & 5 deletions cogs/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from typing import Optional, TYPE_CHECKING
from utils import Restriction
from utils.converters import DateOrTimeToSecondsConverter, TimeTransformer
from utils.checks import is_staff, check_staff, check_bot_or_staff, is_staff_app
from utils.checks import is_staff, check_staff, check_bot_or_staff, is_staff_app, wii_check
from utils.utils import paginate_message, send_dm_message, parse_time, text_to_discord_file, gen_color, \
create_error_embed, create_userinfo_embed

Expand Down Expand Up @@ -937,23 +937,21 @@ async def giverestriction(self,
await interaction.response.send_message(f"{member.mention} now has the {restriction} restriction role{f' until {format_dt(end_time)}.' if end_time else '.'}")
await self.logs.post_action_log(interaction.user, member, restriction_action[restriction], reason=reason, until=end_time)

@wii_check()
@commands.guild_only()
@commands.command()
async def takewii(self, ctx: GuildContext, member: discord.Member):
"""Remove access to the Wii channel."""
if not check_staff(ctx.bot, 'Helper', member.id) or ctx.bot.roles['Wii-Assistance'] not in ctx.author.roles:
return await ctx.send("You can't use this command!")
if await check_bot_or_staff(ctx, member, "no-wii"):
return
await member.add_roles(ctx.bot.roles['No-Wii'])
await ctx.send("Wii access taken.")

@wii_check()
@commands.guild_only()
@commands.command()
async def givewii(self, ctx: GuildContext, member: discord.Member):
"""Restore access to the Wii channel."""
if not check_staff(ctx.bot, 'Helper', member.id) or ctx.bot.roles['Wii-Assistance'] not in ctx.author.roles:
return await ctx.send("You can't use this command!")
await member.remove_roles(ctx.bot.roles['No-Wii'])
await ctx.send("Wii access restored.")

Expand Down
15 changes: 14 additions & 1 deletion utils/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,21 @@ async def predicate(ctx):
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 (
if not check_staff(ctx.bot, 'Helper', author.id) and not 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):
raise InsufficientStaffRank("You can't use this command.")
return False
return True

return commands.check(predicate)


def wii_check():
async def predicate(ctx):
author = ctx.author
if not check_staff(ctx.bot, 'Helper', author.id) and not check_staff(ctx.bot, 'Staff', author.id) and (
ctx.bot.roles['Wii-Assistance'] not in author.roles):
raise InsufficientStaffRank("You can't use this command.")
return False
return True

Expand Down

0 comments on commit 71c08ba

Please sign in to comment.