Add delay of 0.5 seconds before deleting original

This commit is contained in:
Ske 2019-02-26 13:44:29 +01:00
parent e4c153f18e
commit f174ce9a03

View File

@ -1,3 +1,4 @@
import asyncio
import re import re
import discord import discord
@ -134,7 +135,11 @@ async def send_proxy_message(conn, original_message: discord.Message, system: Sy
) )
# And finally, gotta delete the original. # 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: try:
await asyncio.sleep(0.5)
await original_message.delete() await original_message.delete()
except discord.Forbidden: except discord.Forbidden:
raise ProxyError( raise ProxyError(