mirror of
https://gitlab.jonasled.de/jonasled/discordbot
synced 2024-11-11 12:32:37 +01:00
101 lines
No EOL
1.3 KiB
Python
101 lines
No EOL
1.3 KiB
Python
#!/usr/bin/env python3
|
|
hangman = ['''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
''','''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=========''','''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=========''','''
|
|
+---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=========''','''
|
|
+---+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=========''','''
|
|
+---+
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=========''', '''
|
|
+---+
|
|
| |
|
|
O |
|
|
|
|
|
|
|
|
|
|
|
=========''', '''
|
|
+---+
|
|
| |
|
|
O |
|
|
| |
|
|
|
|
|
|
|
|
=========''', '''
|
|
+---+
|
|
| |
|
|
O |
|
|
/| |
|
|
|
|
|
|
|
|
=========''', '''
|
|
+---+
|
|
| |
|
|
O |
|
|
/|\ |
|
|
|
|
|
|
|
|
=========''', '''
|
|
+---+
|
|
| |
|
|
O |
|
|
/|\ |
|
|
/ |
|
|
|
|
|
=========''', '''
|
|
+---+
|
|
| |
|
|
O |
|
|
/|\ |
|
|
/ \ |
|
|
|
|
|
=========''']
|
|
|
|
def generateHangmanMessage(word, right, wrong):
|
|
word = list(word)
|
|
right = right.split(";")
|
|
wrong = wrong.split(";")
|
|
message = "```\n" + hangman[len(wrong) if (wrong != ['']) else 0]
|
|
message = message + "```\n\n`"
|
|
for letter in word:
|
|
if(letter in right):
|
|
message = message + letter + " "
|
|
elif not letter in "abcdefghijklmnopqrstuvwxyz":
|
|
message = message + letter + " "
|
|
|
|
else:
|
|
message = message + "_ "
|
|
return message[:-1] + "`" |