Skip to content

Commit

Permalink
Fix wii assistance (#1269)
Browse files Browse the repository at this point in the history
medic_i_have_no_idea_what_i'm_doing.wav
  • Loading branch information
danny8376 authored Feb 8, 2024
1 parent 618a4b9 commit 10afb45
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
24 changes: 24 additions & 0 deletions cogs/assistancewii.py
Original file line number Diff line number Diff line change
@@ -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))
1 change: 1 addition & 0 deletions kurisu.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

cogs = (
'cogs.assistance',
'cogs.assistancewii',
'cogs.assistancewiiu',
'cogs.assistance3ds',
'cogs.assistanceswitch',
Expand Down
11 changes: 6 additions & 5 deletions utils/mdcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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)):
Expand Down

0 comments on commit 10afb45

Please sign in to comment.