Quelques bugfix
This commit is contained in:
@@ -72,6 +72,7 @@ class CocoClient:
|
||||
return out
|
||||
|
||||
def connect(self, nick: str, age: int, is_female: bool, zip_code: str):
|
||||
self.interlocutors = set()
|
||||
self.nick = nick
|
||||
self.histories = defaultdict(list)
|
||||
self.current_interlocutor = None
|
||||
@@ -103,6 +104,9 @@ class CocoClient:
|
||||
return [BotMessage("Il faut sélectionner une conversation d'abord pd")]
|
||||
|
||||
def switch_conv(self, nick: str=None) -> Union[List[BotMessage], BotMessage]:
|
||||
if not self.interlocutors:
|
||||
return BotMessage("Pas de conversations en cours")
|
||||
|
||||
new_interlocutor = None
|
||||
if nick is not None:
|
||||
for usr in self.interlocutors:
|
||||
@@ -110,7 +114,7 @@ class CocoClient:
|
||||
new_interlocutor = usr
|
||||
break
|
||||
else:
|
||||
new_interlocutor = random.choice(self.interlocutors)
|
||||
new_interlocutor = random.choice(list(self.interlocutors))
|
||||
|
||||
if new_interlocutor is None:
|
||||
return BotMessage("Impossible de trouver l'utilisateur")
|
||||
|
||||
+2
-2
@@ -70,7 +70,7 @@ smilies = [":)", ":(", ";)", ":d", ":-o", ":s", ":$", "*-)", "-)", "^o)", ":p",
|
||||
"nw$", "ba$", "ao$", "db$", "si$", "oo$", "co$", "bi$", "cc$", "ye$", "mo$", "aa$", "ci$", "uu$", "ff$",
|
||||
"zz$", "gt$", "ah$", "mm$", "?$", "xx$"]
|
||||
|
||||
special_chars = bidict.bidict({" ": "~", "!": "!", "$": "*7", "%": "*g", "'": "*8", "(": "(", ")": ")", "*": "*s", "=": "*h",
|
||||
special_chars = bidict.bidict({" ": "_", "$": "*7", "%": "*g", "'": "*8", "(": "(", ")": ")", "*": "*s", "=": "*h",
|
||||
"?": "=", "@": "*m", "^": "*l", "_": "*0", "€": "*d", "à": "*a", "â": "*k", "ç": "*c", "è": "*e",
|
||||
"é": "*r", "ê": "*b", "î": "*i", "ï": "*j", "ô": "*o", "ù": "*f", "û": "*u"})
|
||||
|
||||
@@ -82,7 +82,7 @@ def encode_msg(msg : str):
|
||||
|
||||
for char, replacement in special_chars.items():
|
||||
msg = msg.replace(char, replacement)
|
||||
|
||||
msg = ''.join([c for c in msg if ord(c) < 128])
|
||||
return msg
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user