From f91e0a65468f5d9f5d423ecc774e7bc495316ab1 Mon Sep 17 00:00:00 2001 From: DiscordLiz <47602820+DiscordLiz@users.noreply.github.com> Date: Fri, 15 Feb 2019 15:46:36 -0500 Subject: [PATCH] Prevent error when ctx.send_interactive prompt is deleted (#2447) Supress excpetions which may occur when attempting to delete a prompt. fixes #2380 --- redbot/core/commands/context.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/redbot/core/commands/context.py b/redbot/core/commands/context.py index 965a8af30..5338a595c 100644 --- a/redbot/core/commands/context.py +++ b/redbot/core/commands/context.py @@ -1,4 +1,5 @@ import asyncio +import contextlib from typing import Iterable, List import discord from discord.ext import commands @@ -167,7 +168,8 @@ class Context(commands.Context): timeout=timeout, ) except asyncio.TimeoutError: - await query.delete() + with contextlib.suppress(discord.HTTPException): + await query.delete() break else: try: @@ -176,7 +178,8 @@ class Context(commands.Context): # In case the bot can't delete other users' messages, # or is not a bot account # or channel is a DM - await query.delete() + with contextlib.suppress(discord.HTTPException): + await query.delete() return ret async def embed_colour(self):