generated from Nemesis/Exemple
renforcer getNick
This commit is contained in:
parent
d2d9354dec
commit
decebf7346
1 changed files with 16 additions and 1 deletions
15
asmodee.py
15
asmodee.py
|
|
@ -713,6 +713,13 @@ def getNick(room, message): # Obtenir le DisplayName à partir du mxid.
|
||||||
nick = room.user_name(sender).split(' ')[0]
|
nick = room.user_name(sender).split(' ')[0]
|
||||||
except:
|
except:
|
||||||
nick = room.user_name(sender)
|
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)
|
return(nick)
|
||||||
|
|
||||||
async def msg(room,mess,sender,content=False):
|
async def msg(room,mess,sender,content=False):
|
||||||
|
|
@ -1016,6 +1023,8 @@ async def biere(room,message): # Gestion des boissons
|
||||||
alias = room.names[0]
|
alias = room.names[0]
|
||||||
else:
|
else:
|
||||||
alias = ""
|
alias = ""
|
||||||
|
if type(alias) == list:
|
||||||
|
alias = alias[0]
|
||||||
reponse = reponse + "(alias : " + alias + ")\n"
|
reponse = reponse + "(alias : " + alias + ")\n"
|
||||||
for cle,valeur in breuvages.items():
|
for cle,valeur in breuvages.items():
|
||||||
reponse = reponse + cle[0] + " / " + str(cle[1]) + " : " + valeur + "\n"
|
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]
|
alias = room.names[0]
|
||||||
else:
|
else:
|
||||||
alias = ""
|
alias = ""
|
||||||
|
if type(alias) == list:
|
||||||
|
alias = alias[0]
|
||||||
reponse = ""
|
reponse = ""
|
||||||
try:
|
try:
|
||||||
reponse = welcome[room.room_id]
|
reponse = welcome[room.room_id]
|
||||||
except:
|
except:
|
||||||
reponse = ""
|
reponse = ""
|
||||||
if (membership == "join" and prev_member != "join"):
|
if (membership == "join" and prev_member != "join"):
|
||||||
|
try:
|
||||||
await msg(room,"Bienvenue sur " + alias + ", " + nick + ". " + reponse,sender)
|
await msg(room,"Bienvenue sur " + alias + ", " + nick + ". " + reponse,sender)
|
||||||
|
except:
|
||||||
|
print(alias)
|
||||||
|
print(nick)
|
||||||
elif (membership == "leave" and prev_member != "leave"):
|
elif (membership == "leave" and prev_member != "leave"):
|
||||||
await msg(room,"Au revoir " + nick + "!",sender)
|
await msg(room,"Au revoir " + nick + "!",sender)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue