From bd07d3d4e8cc58a7120f0d6cda5b0a49c154eaa8 Mon Sep 17 00:00:00 2001 From: 0n1udra Date: Sun, 10 Apr 2022 02:06:33 -0400 Subject: [PATCH] Moved code portion to get wanted result Had to mess around where to put this code portion, under or above the ctx.send, also should the lines -=1 be above or below the if break if statement. Got the wanted result. --- source/slime_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/slime_bot.py b/source/slime_bot.py index 2c2a53a..ed31fad 100644 --- a/source/slime_bot.py +++ b/source/slime_bot.py @@ -392,11 +392,11 @@ async def chatlog(self, ctx, lines=10): return False for line in log_data: - line = line.split(']: <', 1)[-1].split('>', 1) - await ctx.send(f"**{line[0]}:** {line[-1][1:]}") + if lines <= 0: break lines -= 1 - if lines == 0: break + line = line.split(']: <', 1)[-1].split('>', 1) + await ctx.send(f"**{line[0]}:** {line[-1][1:]}") await ctx.send("-----END-----") lprint(ctx, f"Fetched chat log")