Make ave happy (and the bot work)
This commit is contained in:
parent
3ef04a6af5
commit
88dd96910c
1 changed files with 8 additions and 5 deletions
13
cogs/err.py
13
cogs/err.py
|
@ -9,18 +9,21 @@ class Err:
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
self.dds_re = re.compile(r'0\d{2}\-\d{4}')
|
||||||
|
self.wiiu_re = re.compile(r'1\d{2}\-\d{4}')
|
||||||
|
self.switch_re = re.compile(r'2\d{3}\-\d{4}')
|
||||||
print("Err has been loaded!")
|
print("Err has been loaded!")
|
||||||
|
|
||||||
@commands.command(aliases=["nxerr", "serr", "nin_err"])
|
@commands.command(aliases=["nxerr", "serr", "nin_err"])
|
||||||
async def err(self, ctx, err: str):
|
async def err(self, ctx, err: str):
|
||||||
|
|
||||||
if re.match(r'0\d{2}\-\d{4}', err):
|
if self.dds_re.match(err):
|
||||||
err_console = "3DS"
|
err_console = "3DS"
|
||||||
|
|
||||||
elif re.match(r'1\d{2}\-\d{4}', err):
|
elif self.wiiu_re.match(err):
|
||||||
err_console = "Wii U"
|
err_console = "Wii U"
|
||||||
|
|
||||||
elif re.match(r'2\d{3}\-\d{4}', err):
|
elif self.switch_re.match(err):
|
||||||
err_console = "Switch"
|
err_console = "Switch"
|
||||||
module = int(err[0:4]) - 2000
|
module = int(err[0:4]) - 2000
|
||||||
desc = int(err[5:9])
|
desc = int(err[5:9])
|
||||||
|
@ -41,11 +44,11 @@ class Err:
|
||||||
err_description = errcode_range[2]
|
err_description = errcode_range[2]
|
||||||
|
|
||||||
embed = discord.Embed(title='0x{:X} / {}'.format(errcode, err), description="*Console: {} \n Module: {}* \n Error Description: {} \n".format(err_console, err_module, err_description))
|
embed = discord.Embed(title='0x{:X} / {}'.format(errcode, err), description="*Console: {} \n Module: {}* \n Error Description: {} \n".format(err_console, err_module, err_description))
|
||||||
await self.bot.say(embed=embed)
|
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
|
elif err in switch_game_err: # Special Case Handling because Nintendo feels like its required to break their format lol
|
||||||
game,desc = switch_game_err[err].split(":")
|
game,desc = switch_game_err[err].split(":")
|
||||||
await self.bot.say(embed=discord.Embed(title=err, description="*Console: {} \n Game: {}* \n Error Description: {}".format(err_console, game, desc)))
|
await ctx.send(embed=discord.Embed(title=err, description="*Console: {} \n Game: {}* \n Error Description: {}".format(err_console, game, desc)))
|
||||||
return
|
return
|
||||||
|
|
||||||
elif err.startswith("0x"):
|
elif err.startswith("0x"):
|
||||||
|
|
Loading…
Reference in a new issue