From 7e313055de081fecdff3ee7c3e242c26ac2b8e42 Mon Sep 17 00:00:00 2001 From: tumGER <25822956+tumGER@users.noreply.github.com> Date: Sun, 23 Dec 2018 17:16:56 +0100 Subject: [PATCH] [ERR] Add Wii U, 3DS, Switch Hex, 3DS Hex, Error support --- cogs/err.py | 122 ++++++++++++++++++++++++++++++++++++++++++----- data/errcodes.py | 30 ++++++------ 2 files changed, 126 insertions(+), 26 deletions(-) diff --git a/cogs/err.py b/cogs/err.py index 8274e60..4d28b7a 100644 --- a/cogs/err.py +++ b/cogs/err.py @@ -17,22 +17,50 @@ class Err: @commands.command(aliases=["nxerr", "serr", "nin_err"]) async def err(self, ctx, err: str): - if self.dds_re.match(err): - err_console = "3DS" + if self.dds_re.match(err): # 3DS - dds -> Drei DS -> Three DS + if err in dds_errcodes: + err_description = dds_errcodes[err] + else: + err_description = "It seems like your error code is unknown. You should report relevant details to <@141532589725974528> so it can be added to the bot." + # Make a nice Embed out of it + embed = discord.Embed(title=err, url="https://www.youtube.com/watch?v=x3yXlomPCmU", description=err_description) + embed.set_footer(text="Console: 3DS") - elif self.wiiu_re.match(err): - err_console = "Wii U" + # Send message, crazy + await ctx.send(embed=embed) - elif self.switch_re.match(err): + + elif self.wiiu_re.match(err): # Wii U + module = err[1:2] # Is that even true, idk just guessing + desc = err[4:7] + if err in wii_u_errors: + err_description = wii_u_errors[err] + else: + err_description = "It seems like your error code is unknown. You should report relevant details to <@141532589725974528> so it can be added to the bot." + + # Make a nice Embed out of it + embed = discord.Embed(title=err, url="https://www.youtube.com/watch?v=x3yXlomPCmU", description=err_description) + embed.set_footer(text="Console: Wii U") + embed.add_field(name="Module", value=module, inline=True) + embed.add_field(name="Description", value=desc, inline=True) + + # Send message, crazy + await ctx.send(embed=embed) + + + elif self.switch_re.match(err): # Switch + # Transforming into Hex module = int(err[0:4]) - 2000 desc = int(err[5:9]) errcode = (desc << 9) + module + # Searching for Modules in list if module in switch_modules: err_module = switch_modules[module] else: err_module = "Unknown" + # Searching for error codes related to the Switch (Doesn't include Special Cases) if errcode in switch_known_errcodes: err_description = switch_known_errcodes[errcode] elif errcode in switch_support_page: @@ -41,14 +69,16 @@ class Err: for errcode_range in switch_known_errcode_ranges[module]: if desc >= errcode_range[0] and desc <= errcode_range[1]: err_description = errcode_range[2] + else: + err_description = "It seems like your error code is unknown. You should report relevant details to <@141532589725974528> so it can be added to the bot." + # Make a nice Embed out of it embed = discord.Embed(title="{} / {}".format(errcode, err), url="https://www.youtube.com/watch?v=x3yXlomPCmU", description=err_description) - embed.set_footer(text="Console: Switch") - embed.add_field(name="Module", value="{} ({})".format(err_module, module), inline=True) embed.add_field(name="Description", value=desc, inline=True) + # Send message, crazy await ctx.send(embed=embed) elif err in switch_game_err: # Special Case Handling because Nintendo feels like its required to break their format lol @@ -60,12 +90,82 @@ class Err: await ctx.send(embed=embed) - elif err.startswith("0x"): - pass # Ladies and Gentleman, this will be a guessing game ;) - # 1 Switch 2 3DS / Wii U + # Removing any chance of hex having to go to the awful guessing game we wil have to do soon + elif err in switch_known_errcodes: + err_description = switch_known_errcodes[err] + err = err[2:] + errcode = int(err, 16) + module = errcode & 0x1FF + desc = (errcode >> 9) & 0x3FFF + if module in switch_modules: + err_module = switch_modules[module] + else: + err_module = "Unknown" + + # Make a nice Embed out of it + embed = discord.Embed(title="{} / {}".format(errcode, err), url="https://www.youtube.com/watch?v=x3yXlomPCmU", description=err_description) + embed.set_footer(text="Console: Switch") + embed.add_field(name="Module", value="{} ({})".format(err_module, module), inline=True) + embed.add_field(name="Description", value=desc, inline=True) + + # Send message, crazy + await ctx.send(embed=embed) + + + # The Guessing Game of Hex (Could be both 3DS or Switch so we have to constantly assume :P) + elif err.startwith("0x"): + err = err[2:] # Both work without the 0x + # Most Switch Hex error should be detected by now so the chance that it's 3DS is much higher + derr = err.strip() + rc = int(derr, 16) + desc = rc & 0x3FF + mod = (rc >> 10) & 0xFF + summ = (rc >> 21) & 0x3F + level = (rc >> 27) & 0x1F + if mod in dds_modules and summ in dds_summaries and desc in dds_descriptions and level in dds_levels: + # ^ Lets just make extra sure that everything is right :P + embed = discord.Embed(title="0x{:X}".format(rc)) + embed.add_field(name="Module", value=dds_modules[mod], inline=False) + embed.add_field(name="Description", value=dds_descriptions[desc], inline=False) + embed.add_field(name="Summary", value=dds_summaries[summ], inline=False) + embed.add_field(name="Level", value=dds_levels[level], inline=False) + embed.set_footer(text="Console: 3DS") + + await ctx.send(embed=embed) + return + + # Now lets just search for the last remaining switch errors to make sure + errcode = int(err, 16) + module = errcode & 0x1FF + desc = (errcode >> 9) & 0x3FFF + errcode = '{:04}-{:04}'.format(module + 2000, desc) + + # Searching for error codes related to the Switch (Doesn't include Special Cases) + if errcode in switch_known_errcodes: + err_description = switch_known_errcodes[errcode] + elif errcode in switch_support_page: + err_description = switch_support_page[errcode] + elif module in switch_known_errcode_ranges: + for errcode_range in switch_known_errcode_ranges[module]: + if desc >= errcode_range[0] and desc <= errcode_range[1]: + err_description = errcode_range[2] + else: + err_description = "It seems like your error code is unknown. You should report relevant details to <@141532589725974528> so it can be added to the bot." + + if module in switch_modules: + err_module = switch_modules[module] + else: + err_module = "Unknown" + + # Make a nice Embed out of it + embed = discord.Embed(title="{} / {}".format(errcode, err), url="https://www.youtube.com/watch?v=x3yXlomPCmU", description=err_description) + embed.set_footer(text="Console: Switch") + embed.add_field(name="Module", value="{} ({})".format(err_module, module), inline=True) + embed.add_field(name="Description", value=desc, inline=True) + await ctx.send(embed=embed) else: - pass + await ctx.send("Unknown Format - This is either no error code or you made some mistake!") def setup(bot): bot.add_cog(Err(bot)) diff --git a/data/errcodes.py b/data/errcodes.py index 8033424..5162e8c 100644 --- a/data/errcodes.py +++ b/data/errcodes.py @@ -925,12 +925,12 @@ dds_errcodes = { # Nintendo 3DS '001-0502': 'Some sort of network error related to friend presence. "Allow Friends to see your online status" might fix this.', '001-0803': 'Could not communicate with authentication server.', - '002-0102': 'System is permanently banned by Nintendo. You cannot ask how to fix this issue here.', - '002-0107': 'System is temporarily(?) banned by Nintendo. You cannot ask how to fix this issue here.', + '002-0102': 'System is permanently banned by Nintendo. ', + '002-0107': 'System is temporarily(?) banned by Nintendo. ', '002-0119': 'System update required (outdated friends-module)', '002-0120': 'Title update required (outdated title version)', - '002-0121': 'Local friend code SEED has invalid signature.\n\nThis should not happen unless it is modified. The only use case for modifying this file is for system unbanning, so you cannot ask how to fix this issue here.', - '002-0123': 'System is generally banned by Nintendo. You cannot ask how to fix this issue here.', + '002-0121': 'Local friend code SEED has invalid signature.\n\nThis should not happen unless it is modified. The only use case for modifying this file is for system unbanning, so ', + '002-0123': 'System is generally banned by Nintendo. ', '003-1099': 'Access point could not be found with the given SSID.', '003-2001': 'DNS error. If using a custom DNS server, make sure the settings are correct.', '005-4800': 'HTTP Status 500 (Internal Error), unknown cause(?). eShop servers might have issues.', @@ -961,7 +961,7 @@ dds_errcodes = { '009-8401': 'Update data corrupted. Delete and re-install.', '011-3021': 'Cannot find title on Nintendo eShop. Probably incorrect region, or never existed.', '011-3136': 'Nintendo eShop is currently unavailable. Try again later.', - '011-6901': 'System is banned by Nintendo, this error code description is oddly Japanese, generic error code. You cannot ask how to fix this issue here.', + '011-6901': 'System is banned by Nintendo, this error code description is oddly Japanese, generic error code. ', '012-1511': 'Certificate warning.', '014-0016': 'Both systems have the same movable.sed key. Format the target and try system transfer again.', '014-0062': 'Error during System Transfer. Move closer to the wireless router and keep trying.', @@ -972,22 +972,22 @@ dds_errcodes = { '022-2631': 'Nintendo Network ID deleted, or not usable on the current system. If you used System Transfer, the Nintendo Network ID will only work on the target system.', '022-2633': 'Nintendo Network ID temporarily locked due to too many incorrect password attempts. Try again later.', '022-2634': 'Nintendo Network ID is not correctly linked on the system. This can be a result of formatting the SysNAND using System Settings to unlink it from the EmuNAND.\n\n\n\nTinyFormat is recommended for unlinking in the future.', - '022-2812': 'System is permanently banned by Nintendo for illegally playing the Pokemon Sun & Moon ROM leak online before release. You cannot ask how to fix this issue here.', + '022-2812': 'System is permanently banned by Nintendo for illegally playing the Pokemon Sun & Moon ROM leak online before release. ', '022-2815': 'System is banned by Nintendo from Miiverse access.', '032-1820': 'Browser error that asks whether you want to go on to a potentially dangerous website. Can be bypassed by touching "yes".', '090-0212': 'Game is permanently banned from Pokémon Global Link. This is most likely as a result of using altered or illegal save data.', } wii_u_errors = { - '102-2802': 'NNID is permanently banned by Nintendo. You cannot ask how to fix this issue here.', - '102-2805': 'System is banned from accessing Nintendo eShop. You cannot ask how to fix this issue here.', - '102-2812': 'System + linked NNID and access to online services are permanently banned by Nintendo. You cannot ask how to fix this issue here.', - '102-2813': 'System is banned by Nintendo. You cannot ask how to fix this issue here.', - '102-2814': 'System is permanently banned from online multiplayer in a/multiple game(s) (preferably Splatoon). You cannot ask how to fix this issue here.', - '102-2815': 'System is banned from accessing the Nintendo eShop. You cannot ask how to fix this issue here.', - '102-2816': 'System is banned for a/multiple game(s) (preferably Splatoon) for an unknown duration, by attempting to use modified static.pack/+ game files online. You cannot ask how to fix this issue here.', - '106-0306': 'NNID is temporarily banned from a/multiple games (preferably Splatoon) online multiplayer. You cannot ask how to fix this issue here.', - '106-0346': 'NNID is permanently banned from a/multiple games (preferably Splatoon) online multiplayer. You cannot ask how to fix this issue here.', + '102-2802': 'NNID is permanently banned by Nintendo. ', + '102-2805': 'System is banned from accessing Nintendo eShop. ', + '102-2812': 'System + linked NNID and access to online services are permanently banned by Nintendo. ', + '102-2813': 'System is banned by Nintendo. ', + '102-2814': 'System is permanently banned from online multiplayer in a/multiple game(s) (preferably Splatoon). ', + '102-2815': 'System is banned from accessing the Nintendo eShop. ', + '102-2816': 'System is banned for a/multiple game(s) (preferably Splatoon) for an unknown duration, by attempting to use modified static.pack/+ game files online. ', + '106-0306': 'NNID is temporarily banned from a/multiple games (preferably Splatoon) online multiplayer. ', + '106-0346': 'NNID is permanently banned from a/multiple games (preferably Splatoon) online multiplayer. ', '115-1009': 'System is permanently banned from Miiverse.', '121-0902': 'Permissions missing for the action you are trying to perfrom (Miiverse error).', '150-1031': 'Disc could not be read. Either the disc is dirty, the lens is dirty, or the disc is unsupported (i.e. not a Wii or Wii U game).',