From a5b21eaa683272526c6c31c809b224479531856f Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Thu, 23 Mar 2017 22:02:42 -0500 Subject: [PATCH] Handle if someone has battled someone then left the server --- cogs/interaction.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cogs/interaction.py b/cogs/interaction.py index addd501..06210fb 100644 --- a/cogs/interaction.py +++ b/cogs/interaction.py @@ -196,6 +196,10 @@ class Interaction: return battleP1 = discord.utils.find(lambda m: m.id == p1[0], ctx.message.guild.members) + if battleP1 is None: + await ctx.send("The person who challenged you to a battle has apparently left the server....why?") + return + battleP2 = ctx.message.author # Get a random win message from our list @@ -228,6 +232,10 @@ class Interaction: return battleP1 = discord.utils.find(lambda m: m.id == p1[0], ctx.message.guild.members) + if battleP1 is None: + await ctx.send("The person who challenged you to a battle has apparently left the server....why?") + return + battleP2 = ctx.message.author # There's no need to update the stats for the members if they declined the battle