matrix-archive icon indicating copy to clipboard operation
matrix-archive copied to clipboard

Display name of user who left the room or changed their name

Open finefoot opened this issue 4 years ago • 0 comments

Traceback (most recent call last):
  File "matrix-archive.py", line 320, in <module>
    asyncio.get_event_loop().run_until_complete(main())
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "matrix-archive.py", line 305, in main
    await write_event(client, room, f, event)
  File "matrix-archive.py", line 223, in write_event
    await output_file.write(serialize_event(dict(type="text", body=event.body,)))
  File "matrix-archive.py", line 214, in <lambda>
    sender_name=room.users[event.sender].display_name,
KeyError: ...

If a user has left the room, the display name can't be fetched from room.users[event.sender].display_name because there is no event.sender in room.users.

However, the bigger issue is, that when the event took place (the message/media was sent etc.), the user might have had a completely different display name. The Element webapp is able to provide the correct display name, so I guess there has to be a different way to get to the name other than via room.users.

finefoot avatar Oct 15 '20 20:10 finefoot