From e45b7d8b646f53496371f7457ce3b3992da3b8b3 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Wed, 17 Jun 2020 19:56:24 +0100 Subject: [PATCH] Tried to get user input turned into lowercase --- cogs/WaifuImages.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/cogs/WaifuImages.py b/cogs/WaifuImages.py index d0decfb0..98ae3be0 100644 --- a/cogs/WaifuImages.py +++ b/cogs/WaifuImages.py @@ -121,24 +121,38 @@ class Waifus(commands.Cog): array = ['hussein', 'inna', 'kaiju', 'kate', 'lukas', 'marshall', 'stitch', 'zara', 'josh', 'ange', 'gria', 'lilu', 'marcus', 'eric', 'ifrah', - 'janet', 'connor', 'taz', 'ryder'] + 'janet', 'connor', 'taz', 'ryder', 'clarity'] + + proper_name = name.lower() if name: try: - with open(f'images/ServerMembers/{name}.txt') as file: + if proper_name == 'studentjon': + with open(f'images/ServerMembers/{proper_name}.txt') as file: + images_array = file.readlines() + name2 = "Student Jon" + + embed = displayServerImage(images_array, ctx, name2) + await ctx.send(embed=embed) + exit() + + with open(f'images/ServerMembers/{proper_name}.txt') as file: images_array = file.readlines() - embed = displayServerImage(images_array, ctx, name) + embed = displayServerImage(images_array, ctx, proper_name) await ctx.send(embed=embed) except Exception as e: print(e) - message = await ctx.send("Sorry! That person doesn't exist!!") + await ctx.send(f"Sorry! That person doesn't exist!! Try the names listed below!") + for name in array: + await ctx.send(name.capitalize()) + + # col_width = max(len(word) for row in array for word in row) + 2 # padding + # for row in array: + # formattedmsg = ("\n".join(word.ljust(col_width) for word in row)) + # await ctx.send(formattedmsg.capitalize()) - # Let the user read the message for 2.5 seconds - await asyncio.sleep(2.5) - # Delete the message - await message.delete() else: with open(f'images/ServerMembers/{random.choice(array)}.txt') as file: