From 30e3b0559612fd59b4687bacb8865251a2966641 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 27 Jun 2021 17:33:16 -0600 Subject: [PATCH] Fix emoji support --- jarvis/cogs/dbrand.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jarvis/cogs/dbrand.py b/jarvis/cogs/dbrand.py index 40c07cc..46b0943 100644 --- a/jarvis/cogs/dbrand.py +++ b/jarvis/cogs/dbrand.py @@ -47,10 +47,15 @@ class DbrandCog(commands.Cog): async def _shipping(self, ctx, *, search: str): if not re.match(r"^[A-Z- ]+$", search, re.IGNORECASE): if re.match( - f"^[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]$", + r"^[\U0001f1e6-\U0001f1ff]{2}$", search, re.IGNORECASE, ): + # Magic number, subtract from flag char to get ascii char + uni2ascii = 127365 + search = chr(ord(search[0]) - uni2ascii) + chr( + ord(search[1]) - uni2ascii + ) search = search.split("_")[1][:-1] else: await ctx.send("Please use text to search for shipping.")