From fcf3a6ef2e497f362f69d329bee04cebb9537818 Mon Sep 17 00:00:00 2001 From: aikaterna <20862007+aikaterna@users.noreply.github.com> Date: Mon, 27 Aug 2018 11:29:01 -0700 Subject: [PATCH] [V3 Retrosign] Retrosign line 1 cleanup for input --- retrosign/retrosign.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/retrosign/retrosign.py b/retrosign/retrosign.py index 34bea85..132859c 100644 --- a/retrosign/retrosign.py +++ b/retrosign/retrosign.py @@ -9,6 +9,7 @@ from io import BytesIO import os from random import choice import re +import unicodedata class Retrosign: @@ -35,7 +36,9 @@ class Retrosign: else: return await ctx.send("\N{CROSS MARK} Your line is too long (14 character limit)") elif len(texts) == 3: - texts[0] = re.sub("[^A-Za-z0-9 ]", "", texts[0]) + texts[0] = unicodedata.normalize('NFD', texts[0]).encode('ascii', 'ignore') + texts[0] = texts[0].decode('UTF-8') + texts[0] = re.sub(r'[^A-Za-z0-9 ]', '', texts[0]) if len(texts[0]) >= 15: return await ctx.send( "\N{CROSS MARK} Your first line is too long (14 character limit)" @@ -75,4 +78,4 @@ class Retrosign: await ctx.channel.send(file=image) def __unload(self): - self.session.close() + self.session.detach()