Skip to content

Commit

Permalink
Add wii helpers to the helper system
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenChen committed May 17, 2024
1 parent e0eca6b commit 723e15d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 36 deletions.
20 changes: 1 addition & 19 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, 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

Expand Down Expand Up @@ -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))
2 changes: 1 addition & 1 deletion cogs/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
9 changes: 5 additions & 4 deletions kurisu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...] = (
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
12 changes: 0 additions & 12 deletions utils/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 723e15d

Please sign in to comment.