From f174ce9a03b4737be144ddaf8c95476e133d462f Mon Sep 17 00:00:00 2001 From: Ske Date: Tue, 26 Feb 2019 13:44:29 +0100 Subject: [PATCH] Add delay of 0.5 seconds before deleting original --- src/pluralkit/bot/proxy.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pluralkit/bot/proxy.py b/src/pluralkit/bot/proxy.py index be714727..a5a0f457 100644 --- a/src/pluralkit/bot/proxy.py +++ b/src/pluralkit/bot/proxy.py @@ -1,3 +1,4 @@ +import asyncio import re import discord @@ -134,7 +135,11 @@ async def send_proxy_message(conn, original_message: discord.Message, system: Sy ) # And finally, gotta delete the original. + # We wait half a second or so because if the client receives the message deletion + # event before the message actually gets confirmed sent on their end, the message + # doesn't properly get deleted for them, leading to duplication try: + await asyncio.sleep(0.5) await original_message.delete() except discord.Forbidden: raise ProxyError(