diff --git a/asmodee.py b/asmodee.py index f8ca498..0ac91a7 100755 --- a/asmodee.py +++ b/asmodee.py @@ -713,6 +713,13 @@ def getNick(room, message): # Obtenir le DisplayName à partir du mxid. nick = room.user_name(sender).split(' ')[0] except: nick = room.user_name(sender) + if (nick == None): + print(sender) + print(room.user_name(sender)) + if (sender == None): + nick = "quelqu'un" + else: + return(sender) return(nick) async def msg(room,mess,sender,content=False): @@ -1016,6 +1023,8 @@ async def biere(room,message): # Gestion des boissons alias = room.names[0] else: alias = "" + if type(alias) == list: + alias = alias[0] reponse = reponse + "(alias : " + alias + ")\n" for cle,valeur in breuvages.items(): reponse = reponse + cle[0] + " / " + str(cle[1]) + " : " + valeur + "\n" @@ -1258,13 +1267,19 @@ async def bienvenue(room,message): # Affichage d'un message d'accueil aux nouvea alias = room.names[0] else: alias = "" + if type(alias) == list: + alias = alias[0] reponse = "" try: reponse = welcome[room.room_id] except: reponse = "" if (membership == "join" and prev_member != "join"): - await msg(room,"Bienvenue sur " + alias + ", " + nick + ". " + reponse,sender) + try: + await msg(room,"Bienvenue sur " + alias + ", " + nick + ". " + reponse,sender) + except: + print(alias) + print(nick) elif (membership == "leave" and prev_member != "leave"): await msg(room,"Au revoir " + nick + "!",sender) else: