diff --git a/cogs/assistancewii.py b/cogs/assistancewii.py new file mode 100644 index 00000000..d20136fb --- /dev/null +++ b/cogs/assistancewii.py @@ -0,0 +1,24 @@ +from __future__ import annotations + +import logging +from os.path import dirname, join + +from discord.ext import commands + +from utils.mdcmd import add_md_files_as_commands + +logger = logging.getLogger(__name__) + + +class AssistanceWii(commands.GroupCog): + """ + Wii help commands that will mostly be used in the help channels. + """ + data_dir = join(dirname(__file__), 'assistance-cmds') + + +add_md_files_as_commands(AssistanceWii, console_cmd="wii") + + +async def setup(bot): + await bot.add_cog(AssistanceWii(bot)) diff --git a/kurisu.py b/kurisu.py index 61132970..1463e796 100644 --- a/kurisu.py +++ b/kurisu.py @@ -30,6 +30,7 @@ cogs = ( 'cogs.assistance', + 'cogs.assistancewii', 'cogs.assistancewiiu', 'cogs.assistance3ds', 'cogs.assistanceswitch', diff --git a/utils/mdcmd.py b/utils/mdcmd.py index e11336c3..f4ede979 100644 --- a/utils/mdcmd.py +++ b/utils/mdcmd.py @@ -9,11 +9,12 @@ if TYPE_CHECKING: from typing import Optional, Type - from cogs. assistance import Assistance + from cogs.assistance import Assistance + from cogs.assistancewii import AssistanceWii from cogs.assistancewiiu import AssistanceWiiU from cogs.assistance3ds import Assistance3DS from cogs.assistanceswitch import AssistanceSwitch - AssistanceCogs = Assistance | AssistanceWiiU | Assistance3DS | AssistanceSwitch + AssistanceCogs = Assistance | AssistanceWii | AssistanceWiiU | Assistance3DS | AssistanceSwitch systems_no_aliases = ('3ds', 'wiiu', 'vwii', 'switch', 'wii', 'dsi') aliases = { @@ -153,7 +154,7 @@ def check_console(message, channel, consoles): consoles = (consoles,) if message in consoles: return True - elif ("wii" not in consoles or channel.startswith("legacy")) and channel.startswith(consoles) and message not in systems: + elif channel.startswith(tuple(f"{c}-" for c in consoles)) and message not in systems: return True return False @@ -170,7 +171,7 @@ def make_cmd(name: str, help_desc: 'Optional[str]', embeds: 'dict[str, discord.E async def multi_cmd(self, ctx: commands.Context, *, consoles: str = ''): supported_consoles = list(embeds) for s in supported_consoles: - if s in {'dsi', 'wii'}: + if s in {'dsi'}: # special case for legacy channel supported_consoles.append('legacy') # replace aliases with the expected console @@ -194,7 +195,7 @@ async def multi_cmd(self, ctx: commands.Context, *, consoles: str = ''): for console in requested_consoles: for embed_console, embed in embeds.items(): cons = [embed_console] - if embed_console in {'dsi', 'wii'}: + if embed_console in {'dsi'}: # special case for legacy channel cons.append('legacy') if check_console(console, channel_name, tuple(cons)):