Skip to content

Commit

Permalink
Merge branch 'nh-server:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
shinobijolteon authored Sep 18, 2024
2 parents 92947f9 + d306f36 commit 6b79f63
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cogs/assistance-cmds/cfwcheck.wiiu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion cogs/assistance-cmds/nospace.3ds.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.**
7 changes: 5 additions & 2 deletions cogs/assistance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
53 changes: 53 additions & 0 deletions cogs/assistancewii.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand All @@ -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 <error code>`
"""
# 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")

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
pillow-heif==0.17.0
markdownify==0.13.1

0 comments on commit 6b79f63

Please sign in to comment.