From 27693bafa0d8b1c5e22a7672071266dbd81527ec Mon Sep 17 00:00:00 2001 From: sgoudham Date: Wed, 17 Jun 2020 23:46:19 +0100 Subject: [PATCH] Added error handling --- cogs/WaifuImages.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cogs/WaifuImages.py b/cogs/WaifuImages.py index 240b6d37..e6bf6613 100644 --- a/cogs/WaifuImages.py +++ b/cogs/WaifuImages.py @@ -1,6 +1,7 @@ import asyncio import datetime import random +import string import discord from discord.ext import commands @@ -122,7 +123,7 @@ class Waifus(commands.Cog): 'marshall', 'stitch', 'zara', 'josh', 'ange', 'gria', 'lilu', 'marcus', 'eric', 'ifrah', 'janet', 'connor', 'taz', 'ryder', 'clarity', - 'izzy'] + 'izzy', 'david'] if name: proper_name = name.lower() @@ -135,6 +136,12 @@ class Waifus(commands.Cog): except Exception as e: print(e) + + await ctx.send(f"Sorry! That person doesn't exist!! Try the names listed below!") + + nice = string.capwords(', '.join(map(str, array))) + await ctx.send(nice) + else: with open(f'images/ServerMembers/{random.choice(array)}.txt') as file: array = file.readlines()