[customcom] properly catch TimeoutErrors

This commit is contained in:
zephyrkul 2020-08-18 18:32:06 -06:00 committed by GitHub
parent 3e6a73ae8c
commit 7d6662e6b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,7 +164,7 @@ class CommandObj:
pred = MessagePredicate.yes_or_no(ctx) pred = MessagePredicate.yes_or_no(ctx)
try: try:
await self.bot.wait_for("message", check=pred, timeout=30) await self.bot.wait_for("message", check=pred, timeout=30)
except TimeoutError: except asyncio.TimeoutError:
await ctx.send(_("Response timed out, please try again later.")) await ctx.send(_("Response timed out, please try again later."))
return return
if pred.result is True: if pred.result is True:
@ -175,7 +175,7 @@ class CommandObj:
resp = await self.bot.wait_for( resp = await self.bot.wait_for(
"message", check=MessagePredicate.same_context(ctx), timeout=180 "message", check=MessagePredicate.same_context(ctx), timeout=180
) )
except TimeoutError: except asyncio.TimeoutError:
await ctx.send(_("Response timed out, please try again later.")) await ctx.send(_("Response timed out, please try again later."))
return return
response = resp.content response = resp.content