(re)add err2 + err3
@@ -225,5 +225,45 @@ class CTRErr:
result += self.get_name(self.levels, level)
await self.bot.say(result)
+ @commands.command(pass_context=True)
+ async def err2(self, ctx, err: str):
+ """Parses CTR error codes, with a fancy embed (TEST1). 0x prefix is not required. \n Example: .err 0xD960D02B"""
+ err = err.strip()
+ if err.startswith("0x"):
+ err = err[2:]
+ rc = int(err, 16)
+ desc = rc & 0x3FF
+ mod = (rc >> 10) & 0xFF
+ summ = (rc >> 21) & 0x3F
+ level = (rc >> 27) & 0x1F
+
+ # garbage
+ embed = discord.Embed(title="0x{:X}".format(rc))
+ embed.add_field(name="Module", value=self.get_name(self.modules, mod), inline=False)
+ embed.add_field(name="Description", value=self.get_name(self.descriptions, desc), inline=False)
+ embed.add_field(name="Summary", value=self.get_name(self.summaries, summ), inline=False)
+ embed.add_field(name="Level", value=self.get_name(self.levels, level), inline=False)
+ await self.bot.say("", embed=embed)
+
+ @commands.command(pass_context=True)
+ async def err3(self, ctx, err: str):
+ """Parses CTR error codes, with a fancy embed (TEST2). 0x prefix is not required. \n Example: .err 0xD960D02B"""
+ err = err.strip()
+ if err.startswith("0x"):
+ err = err[2:]
+ rc = int(err, 16)
+ desc = rc & 0x3FF
+ mod = (rc >> 10) & 0xFF
+ summ = (rc >> 21) & 0x3F
+ level = (rc >> 27) & 0x1F
+
+ # garbage
+ embed = discord.Embed(title="0x{:X}".format(rc))
+ embed.add_field(name="Module", value=self.get_name(self.modules, mod), inline=True)
+ embed.add_field(name="Description", value=self.get_name(self.descriptions, desc), inline=True)
+ embed.add_field(name="Summary", value=self.get_name(self.summaries, summ), inline=True)
+ embed.add_field(name="Level", value=self.get_name(self.levels, level), inline=True)
+ await self.bot.say("", embed=embed)
+
def setup(bot):
bot.add_cog(CTRErr(bot))
