Skip to content

Commit

Permalink
Merge pull request #8 from finefoot/finefoot-patch-3
Browse files Browse the repository at this point in the history
Add workaround for rooms where a user has left
  • Loading branch information
russelldavies authored Nov 4, 2020
2 parents 39add7d + e603d94 commit 9085244
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion matrix-archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,16 @@ async def write_event(
client: AsyncClient, room: MatrixRoom, output_file: TextIO, event: RoomMessage
) -> None:
media_dir = mkdir(f"{OUTPUT_DIR}/{room.display_name}_{room.room_id}_media")
sender_name = f"<{event.sender}>"
if event.sender in room.users:
# If user is still present in room, include current nickname
sender_name = f"{room.users[event.sender].display_name} {sender_name}"
serialize_event = lambda event_payload: yaml.dump(
[
{
**dict(
sender_id=event.sender,
sender_name=room.users[event.sender].display_name,
sender_name=sender_name,
timestamp=event.server_timestamp,
),
**event_payload,
Expand Down

0 comments on commit 9085244

Please sign in to comment.