Added error command to display errors

This commit is contained in:
phixxy 2023-07-25 17:35:43 -07:00
parent e092c4e65b
commit 947be7731e

View file

@ -691,6 +691,23 @@ async def meme(ctx):
await handle_error(error) await handle_error(error)
await ctx.send('Something went wrong try again. Usage: !meme (topic)') await ctx.send('Something went wrong try again. Usage: !meme (topic)')
@bot.command(
description="Errors",
help="Shows the last errors that were logged.",
brief="Display Errors"
)
async def errors(ctx, amount="5"):
output = ""
amount = int(amount)
try:
with open("databases/error_log.txt", 'r') as f:
for line in (f.readlines() [-amount:]):
output += line
await ctx.send(output)
except Exception as error:
await handle_error(error)
@bot.command( @bot.command(
description="RSGP", description="RSGP",
help="Uses probably outdated information to calculate how much rsgp is worth in usd. Usage: !rsgp (amount)", help="Uses probably outdated information to calculate how much rsgp is worth in usd. Usage: !rsgp (amount)",