From 433aaee7bebb8d91adec317d9954f37429926dc3 Mon Sep 17 00:00:00 2001 From: phxntxm Date: Sun, 14 Oct 2018 12:23:48 -0500 Subject: [PATCH] Catch if someone has booped someone else, but not in this server --- cogs/stats.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cogs/stats.py b/cogs/stats.py index b8b907b..187103f 100644 --- a/cogs/stats.py +++ b/cogs/stats.py @@ -206,7 +206,11 @@ class Stats: sorted_boops = [x for x in sorted_boops if x[0] in server_member_ids] # Since this is sorted, we just need to get the following information on the first user in the list - most_id, most_boops = sorted_boops[0] + try: + most_id, most_boops = sorted_boops[0] + except IndexError: + await ctx.send("You have not booped anyone in this server {}".format(ctx.message.author.mention)) + return member = ctx.message.guild.get_member(int(most_id))