Fixed emoji issue

This commit is contained in:
2020-11-15 10:33:42 +01:00
parent 519b629a2d
commit e49c3e0d6c
2 changed files with 14 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ import asyncio
import threading
from functions.timer import Timer
from data import constants
import re
from data.DatabaseConnection import *
# 25216 --> uuid server
@@ -36,13 +37,22 @@ def get_player_uuid(minecraftname):
raise PlayerError()
return data_string
def deEmojify(text):
regrex_pattern = re.compile(pattern = "["
u"\U0001F600-\U0001F64F" # emoticons
u"\U0001F300-\U0001F5FF" # symbols & pictographs
u"\U0001F680-\U0001F6FF" # transport & map symbols
u"\U0001F1E0-\U0001F1FF" # flags (iOS)
"]+", flags = re.UNICODE)
return regrex_pattern.sub(r'',text)
def send_chat(discordname, minecraftname, code):
HOST = '192.168.1.214' # The server's hostname or IP address
PORT = 25224 # The port used by the server
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
s.send(bytes("{}\t{}\t{}\n".format(discordname, minecraftname, code), encoding="ascii"))
s.send(bytes("{}\t{}\t{}\n".format(deEmojify(discordname), minecraftname, code), encoding="ascii"))
data = s.recv(1024)
data_string = data.decode("utf-8").strip('\n')
if data_string == "PlayerError":
@@ -149,8 +159,8 @@ class PlayerLink(commands.Cog):
except PlayerError:
await ctx.send("Player '" + arg + "' not found")
except:
await ctx.send("Something went wrong")
# except:
# await ctx.send("Something went wrong")
@commands.command(name="Unlink")
async def unlink(self, ctx):

View File

@@ -245,7 +245,7 @@ class Quiz(commands.Cog):
embed.add_field(name="Question:", value=f"{shaken_word}", inline=False)
embed.add_field(name="Reward:", value=f"${word['reward']} in game", inline=False)
embed.add_field(name="Answer:", value=f"{word['word']}", inline=False)
embed.add_field(name="Answer:", value=f"{word['word']}", inline=Falvse)
try:
message = await self.client.wait_for("message", check=lambda message: message.content.lower() == word['word'].lower(), timeout=self.timeout)