Trying to make sure that ~w list doesn't colide with other commands

pull/2/head
sgoudham 4 years ago
parent 0cee215a14
commit 03d84a0515

@ -227,28 +227,28 @@ class Waifus(commands.Cog):
# Send the list of waifus in the bot to the channel # Send the list of waifus in the bot to the channel
waifu_list = string.capwords(', '.join(map(str, waifu_array))) waifu_list = string.capwords(', '.join(map(str, waifu_array)))
await ctx.send(waifu_list) await ctx.send(waifu_list)
sys.exit(0)
# Surround with try/except to catch any exceptions that may occur else:
try: # Surround with try/except to catch any exceptions that may occur
try:
# Retrieve image of the waifu specified # Retrieve image of the waifu specified
with open(f'images/AnimeImages/Waifus/{proper_waifu}.txt') as file: with open(f'images/AnimeImages/Waifus/{proper_waifu}.txt') as file:
w_array = file.readlines() w_array = file.readlines()
# Get the full name of the waifu # Get the full name of the waifu
full_name = Abbrev(proper_waifu) full_name = Abbrev(proper_waifu)
# Embed the image into a message and send it to the channel # Embed the image into a message and send it to the channel
embed = displayAnimeImage(w_array, ctx, full_name) embed = displayAnimeImage(w_array, ctx, full_name)
await ctx.send(embed=embed) await ctx.send(embed=embed)
except Exception as e: except Exception as e:
print(e) print(e)
# Send error message saying that the person isn't recognised # Send error message saying that the person isn't recognised
await ctx.send(f"Sorry! That waifu doesn't exist!" await ctx.send(f"Sorry! That waifu doesn't exist!"
f"\nPlease do **~w list** to see the list of waifu's") f"\nPlease do **~w list** to see the list of waifu's")
else: else:
# Get embed from randomWaifu() and send it to the channel # Get embed from randomWaifu() and send it to the channel

Loading…
Cancel
Save