Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji doesnt substitute the letters #12

Open
TheDarkKnight69 opened this issue Jun 10, 2022 · 0 comments
Open

Emoji doesnt substitute the letters #12

TheDarkKnight69 opened this issue Jun 10, 2022 · 0 comments

Comments

@TheDarkKnight69
Copy link

Whatever be the guess, the letters do not get substituted, it always stays gray.
My code snippet is:
`def generate_colored_words(guess: str, answer: str) -> str:
"""Return string of emojis with the letter colored"""
colored_word = [EMOJI_CODES["grey"][letter] for letter in guess]
answer_letters = list(answer)
guess_letters = list(guess)
#change letter to green if same letter and same place
for i in range(len(guess_letters)):
if guess_letters[i] == answer_letters[i]:
colored_word[i] == EMOJI_CODES["green"][guess_letters[i]]
answer_letters[i] = None
guess_letters[i] = None
#change letter to yellow if same letter and different place
for i in range(len(guess_letters)):
if guess_letters[i] is not None and guess_letters[i] in answer_letters:
colored_word[i] == EMOJI_CODES["yellow"][guess_letters[i]]
answer_letters[answer_letters.index(guess_letters[i])] = None
return "".join(colored_word)

def update_embed(embed: nextcord.Embed, guess : str):
puzzle_id = int(embed.footer.text.split()[1])
answer = popular_words[puzzle_id]
colored_word = generate_colored_words(guess, answer)
empty_slot = generate_blanks()
embed.description = embed.description.replace(empty_slot, colored_word, 1)
return embed
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant