luk3yx's hotfix for removing translation strings

Not sure if this fixes it per se as I've been unable to reproduce the issue myself despite witnessing it on another user's relay. At the very least, it doesn't break anything when tested.
This commit is contained in:
archfan 2021-05-31 18:46:17 +00:00 committed by GitHub
parent 0f8e82b931
commit e74006c9b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ import asyncio
import json
import time
import configparser
import re
config = configparser.ConfigParser()
@ -78,6 +79,8 @@ async def handle(request):
data = json.loads(text)
if data['type'] == 'DISCORD-RELAY-MESSAGE':
msg = discord.utils.escape_mentions(data['content'])[0:2000]
r = re.compile(r'\x1b(T|F|E|\(T@[^\)]*\))')
msg = r.sub('', data['content'])
if 'context' in data.keys():
id = int(data['context'])
user = await get_or_fetch_user(id)