Fix emoji support

This commit is contained in:
Zeva Rose 2021-06-27 17:33:16 -06:00
parent 0c325d07f0
commit 30e3b05596

View file

@ -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.")