diff --git a/functions/reactWord.py b/functions/reactWord.py index 0a01214..854d96f 100644 --- a/functions/reactWord.py +++ b/functions/reactWord.py @@ -83,10 +83,10 @@ def check(content, earlier=[]): for letter in content[0]: c = content[0].count(letter) - # If a letter was added twice, but there is only one, that's an issue - if c != 1 and letter not in doubles: + # If a letter was added three times, but there is only two, that's an issue + if c > 2 and letter not in doubles: return False, ["Er zijn niet genoeg **{}**'s om dit woord te reacten.".format(letter)] - elif c > 1 and letter in doubles and len(doubles[letter]) < c: + elif c > 2 and letter in doubles and len(doubles[letter]) < c: return False, ["Er zijn niet genoeg **{}**'s om dit woord te reacten.".format(letter)] # Array of emoji's @@ -96,14 +96,24 @@ def check(content, earlier=[]): for letter in content[0]: # Letters if letter.isalpha(): + reg_ind = "regional_indicator_{}".format(letter) + zb = "zb_{}".format(letter.upper()) + # Check if this letter has not been added yet - if "regional_indicator_{}".format(letter) in unidic and unidic["regional_indicator_{}".format(letter)] not in arr: - arr.append(unidic["regional_indicator_{}".format(letter)]) + if reg_ind in unidic and unidic[reg_ind] not in arr: + arr.append(unidic[reg_ind]) # Remove this letter as an option from the list of doubles if letter in doubles: doubles[letter] = doubles[letter][1:] + # Check for Zandbak copies + elif zb in unidic and unidic[zb] not in arr: + arr.append(unidic[zb]) + + # Remove this letter as an option from the list of doubles + if letter in doubles: + doubles[letter] = doubles[letter][1:] # Letter has been added before, but there's a double for it elif letter in doubles: if len(doubles[letter]) == 0: @@ -163,15 +173,15 @@ def allowedCharacters(): def getDoubles(): doubles = { - "a": ["regional_indicator_a", "a", "four"], - "b": ["regional_indicator_b", "b"], - "o": ["regional_indicator_o", "o2", "zero"], - "i": ["regional_indicator_i", "information_source", "one"], - "p": ["regional_indicator_p", "parking"], - "m": ["regional_indicator_m", "m"], - "s": ["regional_indicator_s", "five"], - "g": ["regional_indicator_g", "six"], - "e": ["regional_indicator_e", "three"], + "a": ["regional_indicator_a", "zb_A", "a", "four"], + "b": ["regional_indicator_b", "zb_B", "b"], + "o": ["regional_indicator_o", "zb_O", "o2", "zero"], + "i": ["regional_indicator_i", "zb_I", "information_source", "one"], + "p": ["regional_indicator_p", "zb_P", "parking"], + "m": ["regional_indicator_m", "zb_M", "m"], + "s": ["regional_indicator_s", "zb_S", "five"], + "g": ["regional_indicator_g", "zb_G", "six"], + "e": ["regional_indicator_e", "zb_E", "three"], "!": ["exclamation", "grey_exclamation"], "?": ["question", "grey_question"] } @@ -235,6 +245,32 @@ def getUnicodeDict(): "regional_indicator_x": "🇽", "regional_indicator_y": "🇾", "regional_indicator_z": "🇿", + "zb_A": "<:zb_A:792094798516453387>", + "zb_B": "<:zb_B:792094798986346507>", + "zb_C": "<:zb_C:792094799724412958>", + "zb_D": "<:zb_D:792094799984984124>", + "zb_E": "<:zb_E:792094800093380649>", + "zb_F": "<:zb_F:792094799657566278>", + "zb_G": "<:zb_G:792094800014606336>", + "zb_H": "<:zb_H:792094799745908736>", + "zb_I": "<:zb_I:792094799620079626>", + "zb_J": "<:zb_J:792094799800958976>", + "zb_K": "<:zb_K:792094800069263420>", + "zb_L": "<:zb_L:792094754036383755>", + "zb_M": "<:zb_M:792094704674013234>", + "zb_N": "<:zb_N:792094660281630751>", + "zb_O": "<:zb_O:792094628848467998>", + "zb_P": "<:zb_P:792094590793940992>", + "zb_Q": "<:zb_Q:792094558417584138>", + "zb_R": "<:zb_R:792094529951498260>", + "zb_S": "<:zb_S:792094506526572564>", + "zb_T": "<:zb_T:792094451530334228>", + "zb_U": "<:zb_U:792094420195082240>", + "zb_V": "<:zb_V:792094388716437544>", + "zb_W": "<:zb_W:792094342285754378>", + "zb_X": "<:zb_X:792094308412293190>", + "zb_Y": "<:zb_Y:792094270445322270>", + "zb_Z": "<:zb_Z:792094240212779028>", "a": "🅰️", "b": "🅱️", "o2": "🅾️", @@ -270,6 +306,7 @@ def getAllVariants(char: str): reg_ind = "regional_indicator_{}".format(char) if reg_ind in getUnicodeDict(): variants.append(reg_ind) + variants.append("zb_{}".format(char.upper())) # Number elif char in getNumbers(): @@ -292,6 +329,11 @@ def getAllVariants(char: str): print(variants) for var in variants: rep = ":" + var + ":" + + # Zandbak copies are formatted differently + if var.startswith("zb_"): + rep = getUnicodeDict()[var] + if rep not in uniques: uniques.append(rep)