generated from Nemesis/Exemple
Retour à username
This commit is contained in:
parent
e0b38beb7e
commit
7db29e46c0
1 changed files with 7 additions and 7 deletions
14
asmodee.py
14
asmodee.py
|
|
@ -709,19 +709,19 @@ def getUser(message):
|
||||||
async def getNick(room, message): # Obtenir le DisplayName à partir du mxid.
|
async def getNick(room, message): # Obtenir le DisplayName à partir du mxid.
|
||||||
sender = getUser(message)
|
sender = getUser(message)
|
||||||
nick = None
|
nick = None
|
||||||
#try:
|
|
||||||
# nick = room.user_name(sender).split(' ')[0]
|
|
||||||
#except:
|
|
||||||
# nick = room.user_name(sender)
|
|
||||||
try:
|
try:
|
||||||
nick = await bot.api.get_displayname(sender)
|
nick = room.user_name(sender).split(' ')[0]
|
||||||
|
except:
|
||||||
|
nick = sender
|
||||||
|
#try:
|
||||||
|
#nick = await bot.api.get_displayname(sender)
|
||||||
#members = await bot.api.get_room_members(room.room_id)
|
#members = await bot.api.get_room_members(room.room_id)
|
||||||
#for member in members:
|
#for member in members:
|
||||||
# if member['state_key'] == sender:
|
# if member['state_key'] == sender:
|
||||||
# nick = member['content'].get('displayname')
|
# nick = member['content'].get('displayname')
|
||||||
# break
|
# break
|
||||||
except:
|
#except:
|
||||||
nick = sender
|
#nick = sender
|
||||||
nick = nick if nick is not None else sender
|
nick = nick if nick is not None else sender
|
||||||
return(nick)
|
return(nick)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue