From 723e15dae8756f49715718a02705a0e444ef10dc Mon Sep 17 00:00:00 2001 From: FrozenChen Date: Fri, 17 May 2024 15:31:43 -0300 Subject: [PATCH] Add wii helpers to the helper system --- cogs/mod.py | 20 +------------------- cogs/rules.py | 2 +- kurisu.py | 9 +++++---- utils/checks.py | 12 ------------ 4 files changed, 7 insertions(+), 36 deletions(-) diff --git a/cogs/mod.py b/cogs/mod.py index 2c51f1411..726901540 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -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, wii_check +from utils.checks import is_staff, check_staff, check_bot_or_staff, is_staff_app from utils.utils import paginate_message, send_dm_message, parse_time, text_to_discord_file, gen_color, \ create_error_embed, create_userinfo_embed @@ -937,24 +937,6 @@ 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 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.""" - await member.remove_roles(ctx.bot.roles['No-Wii']) - await ctx.send("Wii access restored.") - async def setup(bot): await bot.add_cog(Mod(bot)) diff --git a/cogs/rules.py b/cogs/rules.py index dfcd23120..56814fca2 100644 --- a/cogs/rules.py +++ b/cogs/rules.py @@ -118,7 +118,7 @@ async def updaterules(self, ctx: KurisuContext): helpers_wiiu = [f"<@{helper}>" for helper, console in helpers.items() if console == 'WiiU'] helpers_legacy = [f"<@{helper}>" for helper, console in helpers.items() if console == 'Legacy'] helpers_switch = [f"<@{helper}>" for helper, console in helpers.items() if console == 'Switch'] - helpers_wii = [m.mention for m in ctx.guild.members if self.bot.roles['Wii-Assistance'] in m.roles] + helpers_wii = [f"<@{helper}>" for helper, console in helpers.items() if console == 'Wii'] await channel.send(self.helper_list) await channel.send(f"{str(self.logo_3ds)} Nintendo 3DS\n" + '\n'.join(helpers_3ds)) await channel.send(f"{str(self.logo_wiiu)} Wii U\n" + '\n'.join(helpers_wiiu)) diff --git a/kurisu.py b/kurisu.py index 63f86c0a0..6740e372c 100644 --- a/kurisu.py +++ b/kurisu.py @@ -191,7 +191,8 @@ async def on_ready(self): self.helper_roles: dict[str, discord.Role] = {"3DS": self.roles['On-Duty 3DS'], "WiiU": self.roles['On-Duty Wii U'], "Switch": self.roles['On-Duty Switch'], - "Legacy": self.roles['On-Duty Legacy'] + "Legacy": self.roles['On-Duty Legacy'], + "Wii": self.roles['On-Duty Wii'] } self.assistance_channels: tuple[discord.TextChannel | discord.VoiceChannel, ...] = ( @@ -276,7 +277,7 @@ async def load_channels(self): 'switch-assistance-1', 'switch-assistance-2', 'helpers', 'watch-logs', 'message-logs', 'upload-logs', 'hacking-general', 'meta', 'appeals', 'legacy-systems', 'dev', 'off-topic', 'voice-and-music', 'bot-cmds', 'bot-talk', 'mods', 'mod-mail', 'mod-logs', 'server-logs', 'bot-err', - 'elsewhere', 'newcomers', 'nintendo-discussion', 'tech-talk', 'hardware', 'streaming-gamer', 'wii-assistance'] + 'elsewhere', 'newcomers', 'nintendo-discussion', 'tech-talk', 'hardware', 'streaming-gamer', 'wii-vwii-assistance'] for n in channels: db_channel = await self.configuration.get_channel_by_name(n) @@ -296,10 +297,10 @@ async def load_channels(self): async def load_roles(self): roles = ['Helpers', 'Staff', 'HalfOP', 'OP', 'SuperOP', 'Owner', 'On-Duty 3DS', 'On-Duty Wii U', - 'On-Duty Switch', 'On-Duty Legacy', 'Probation', 'Retired Staff', 'Verified', 'Trusted', 'Muted', + 'On-Duty Switch', 'On-Duty Legacy', 'On-Duty Wii', 'Probation', 'Retired Staff', 'Verified', 'Trusted', 'Muted', 'No-Help', 'No-elsewhere', 'No-Memes', 'No-art', 'No-animals', '#art-discussion', 'No-Embed', '#elsewhere', 'Small Help', 'meta-mute', 'appeal-mute', 'crc', 'No-Tech', 'help-mute', 'streamer(temp)', '🍰', - 'No-U', 'No-Wii', 'Wii-Assistance'] + 'No-U', 'No-Wii'] for n in roles: db_role = await self.configuration.get_role(n) diff --git a/utils/checks.py b/utils/checks.py index 554656ce4..b08ef7a5f 100644 --- a/utils/checks.py +++ b/utils/checks.py @@ -77,18 +77,6 @@ async def predicate(ctx): 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 - - return commands.check(predicate) - - def check_if_user_can_ready(): async def predicate(ctx): channel = ctx.channel