diff --git a/cogs/assistance-cmds/cfwcheck.wiiu.md b/cogs/assistance-cmds/cfwcheck.wiiu.md index b96df7a5..2cdffd0b 100644 --- a/cogs/assistance-cmds/cfwcheck.wiiu.md +++ b/cogs/assistance-cmds/cfwcheck.wiiu.md @@ -12,6 +12,6 @@ Indexiine: Launches the Homebrew Launcher automatically while opening the browse Haxchi: Launched from the Wii U Menu, will appear as "Haxchi". -CBHC: Launches on boot with a black screen that says `Autobooting....` and has a `DON"T TOUCH ME` icon. +CBHC: Launches on boot with a black screen that says `Autobooting....` and has a `DON'T TOUCH ME` icon. Tiramisu: Launches either on boot or while launching health and safety, will show a black screen + white line upon launch. diff --git a/cogs/assistance-cmds/nospace.3ds.md b/cogs/assistance-cmds/nospace.3ds.md index e0d63249..e092d2c8 100644 --- a/cogs/assistance-cmds/nospace.3ds.md +++ b/cogs/assistance-cmds/nospace.3ds.md @@ -9,6 +9,6 @@ cooldown-per: 15 # Steps to create the backup 1. Copy the Nintendo 3DS folder from the root of your SD card to your computer then delete it from **the SD card.** On Mac, empty the Trash. -2. Boot GodMode9 by holding START on boot then preform a normal NAND backup. After that, power off the system. +2. Boot GodMode9 by holding START on boot then perform a normal NAND backup. After that, power off the system. 3. Copy the files in gm9/out on your SD card to a safe spot on your computer. Then, delete the files from **the SD card.** 4. Copy the Nintendo 3DS folder to your SD card root then delete it **from your computer.** diff --git a/cogs/assistance.py b/cogs/assistance.py index 27b0144b..2a8ccb16 100644 --- a/cogs/assistance.py +++ b/cogs/assistance.py @@ -115,7 +115,7 @@ async def staffreq(self, ctx: GuildContext, *, msg_request: str = ""): @is_staff('Helper') @commands.guild_only() @commands.command() - async def createsmallhelp(self, ctx: GuildContext, console: Literal['3ds', 'switch', 'wiiu', 'legacy'], helpee: discord.Member, *, desc: str): + async def createsmallhelp(self, ctx: GuildContext, console: Literal['3ds', 'switch', 'wiiu', 'wii', 'legacy'], helpee: discord.Member, *, desc: str): """Creates a small help channel for a user. Helper+ only.""" if not self.small_help_category: return await ctx.send("The small help category is not set.") @@ -139,6 +139,9 @@ async def createsoap(self, ctx: GuildContext, helpee: discord.Member): return await ctx.send("The soaps category is not set.") # Channel names can't be longer than 100 characters channel_name = f"3ds-{helpee.name}-soap-🧼"[:100] + for channel in self.soaps_category.text_channels: + if channel.name == channel_name: + return await ctx.send("Soap channel already exists for user.") channel = await self.soaps_category.create_text_channel(name=channel_name) await asyncio.sleep(3) # Fix for discord race condition(?) await channel.set_permissions(helpee, read_messages=True) @@ -293,7 +296,7 @@ async def mkey(self, ctx: KurisuContext, device: Literal['3ds', 'dsi', 'wii', 'w async with self.bot.session.get(api_call) as r: if r.status == 200: ret = await r.json() - return await ctx.send(f'{ctx.author.mention if not ctx.interaction else ""} Your key is {ret["key"]}.', ephemeral=True) + return await ctx.send(f'{ctx.author.mention if not ctx.interaction else ""} Your key is {ret["key"]:05}.', ephemeral=True) else: return await ctx.send(f'{ctx.author.mention if not ctx.interaction else ""} API returned error {r.status}. Please check your values and try again.', ephemeral=True) diff --git a/cogs/assistancewii.py b/cogs/assistancewii.py index d20136fb..b0063ce1 100644 --- a/cogs/assistancewii.py +++ b/cogs/assistancewii.py @@ -2,10 +2,18 @@ import logging from os.path import dirname, join +from typing import TYPE_CHECKING +import discord from discord.ext import commands +from markdownify import markdownify from utils.mdcmd import add_md_files_as_commands +from utils.utils import ConsoleColor, KurisuCooldown + +if TYPE_CHECKING: + from kurisu import Kurisu + from utils.context import KurisuContext logger = logging.getLogger(__name__) @@ -16,6 +24,51 @@ class AssistanceWii(commands.GroupCog): """ data_dir = join(dirname(__file__), 'assistance-cmds') + def __init__(self, bot: Kurisu): + self.bot: Kurisu = bot + + # Cached error codes from Wiimmfi + saved_errors = [] + + @commands.dynamic_cooldown(KurisuCooldown(1, 30.0), commands.BucketType.channel) + @commands.command(aliases=["wfcerror"]) + async def wiierror(self, ctx: KurisuContext, error: int): + """ + Get information about an error code displayed on the Wii and/or the Nintendo WFC. + Usage: `wiierror ` + """ + # It seems error codes must be within 6 digits + if error > 999999: + return await ctx.send(f"{ctx.author.mention} This is an invalid error code. Please try again.") + apicall = f"https://wiimmfi.de/error?m=json&e={error}" + + errorinfo = {} + + # Check if we have this error cached + for i in self.saved_errors: + if i["error"] == error: + errorinfo = i + + # If our error wasn't cached, go ask Wiimmfi + if not errorinfo: + async with ctx.typing(): + async with self.bot.session.get(apicall) as r: + if r.status == 200: + response = await r.json() + errorinfo = response[0] + # Cache the error + self.saved_errors.append(response[0]) + else: + return await ctx.send(f'{ctx.author.mention} API returned error {r.status}. Please check your values and try again.') + + if errorinfo["found"] == 0: + return await ctx.send(f"{ctx.author.mention} This error code does not exist.") + else: + embed = discord.Embed(title=f"Error {error}", colour=ConsoleColor.wii()) + for i in errorinfo["infolist"]: + embed.add_field(name=i["type"], value=f'**{i["name"]}**: {markdownify(i["info"])}', inline=False) + return await ctx.send(embed=embed) + add_md_files_as_commands(AssistanceWii, console_cmd="wii") diff --git a/requirements.txt b/requirements.txt index 167e3a60..c42eaa64 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ xkcd==2.4.2 pytz==2024.1 asyncpg==0.29.0 python-Levenshtein==0.25.1 -pillow-heif==0.17.0 \ No newline at end of file +pillow-heif==0.17.0 +markdownify==0.13.1