From 7db29e46c037c50030a87e31b1104ff9f68cb69c Mon Sep 17 00:00:00 2001 From: nemesis Date: Tue, 11 Nov 2025 22:43:12 +0100 Subject: [PATCH] =?UTF-8?q?Retour=20=C3=A0=20username?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asmodee.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/asmodee.py b/asmodee.py index e2df1fd..3881eea 100644 --- a/asmodee.py +++ b/asmodee.py @@ -709,19 +709,19 @@ def getUser(message): async def getNick(room, message): # Obtenir le DisplayName à partir du mxid. sender = getUser(message) nick = None - #try: - # nick = room.user_name(sender).split(' ')[0] - #except: - # nick = room.user_name(sender) 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) #for member in members: # if member['state_key'] == sender: # nick = member['content'].get('displayname') # break - except: - nick = sender + #except: + #nick = sender nick = nick if nick is not None else sender return(nick)