From 78615b5dc828f39b75bda12c213f9ab9a06d69d8 Mon Sep 17 00:00:00 2001 From: aikaterna <20862007+aikaterna@users.noreply.github.com> Date: Wed, 14 Feb 2018 17:21:51 -0800 Subject: [PATCH] [V3 Core] Add timeout exceptions to [p]servers (#1305) --- redbot/core/core_commands.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index 63022472a..7df64d61b 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -185,7 +185,11 @@ class Core: return m.author == owner while msg is not None: - msg = await self.bot.wait_for("message", check=msg_check, timeout=15) + try: + msg = await self.bot.wait_for("message", check=msg_check, timeout=15) + except asyncio.TimeoutError: + await ctx.send("I guess not.") + break try: msg = int(msg.content) await self.leave_confirmation(guilds[msg], owner, ctx) @@ -199,16 +203,16 @@ class Core: def conf_check(m): return m.author == owner - msg = await self.bot.wait_for("message", check=conf_check, timeout=15) - - if msg is None: + try: + msg = await self.bot.wait_for("message", check=conf_check, timeout=15) + if msg.content.lower().strip() in ("yes", "y"): + await server.leave() + if server != ctx.guild: + await ctx.send("Done.") + else: + await ctx.send("Alright then.") + except asyncio.TimeoutError: await ctx.send("I guess not.") - elif msg.content.lower().strip() in ("yes", "y"): - await server.leave() - if server != ctx.guild: - await ctx.send("Done.") - else: - await ctx.send("Alright then.") @commands.command() @checks.is_owner()