23 Feb 2025 |
Exaltia | if there's better way to do, feel free to tell me
sortedrooms = {}
for each in roomslist.rooms:
result = (await client.space_get_hierarchy(each))
try:
if result.rooms[0]['room_type'] == 'm.space':
print(result.rooms[0])
sortedrooms[result.rooms[0]['children_state'][0]['origin_server_ts']] = result.rooms[0]['name']
except KeyError:
pass
print(dict(sorted(sortedrooms.items())))
| 14:21:30 |
| @adam:bostoncoop.net left the room. | 21:03:23 |
24 Feb 2025 |
| tom changed their display name from tom [back 2025-02-24] to tom. | 11:41:55 |
25 Feb 2025 |
| مهران صارم joined the room. | 02:43:04 |
| @skskskkw:matrix.org joined the room. | 21:31:01 |
28 Feb 2025 |
| @mariamhairy12:matrix.org joined the room. | 08:48:45 |
| @mariamhairy12:matrix.org left the room. | 09:11:55 |
1 Mar 2025 |
| @skskskkw:matrix.org left the room. | 00:40:24 |
2 Mar 2025 |
| Asem Abadla joined the room. | 03:03:06 |
5 Mar 2025 |
| @ashlees:matrix.org joined the room. | 20:26:04 |
| @ashlees:matrix.org left the room. | 20:30:06 |
8 Mar 2025 |
| anton | 00:13:13 |
12 Mar 2025 |
| aurakayra joined the room. | 01:06:55 |
13 Mar 2025 |
| Eestiline Eesti Estonia Margus Meigo DarkFi Waffa joined the room. | 01:23:05 |
| Eestiline Eesti Estonia Margus Meigo DarkFi Waffa changed their display name from Eestiline Eestiline to Eestiline Eesti Estonia Margus Meigo DarkFi Waffa. | 01:30:08 |
| Eestiline Eesti Estonia Margus Meigo DarkFi Waffa set a profile picture. | 01:34:50 |
17 Mar 2025 |
| @rahulranjan:matrix.org joined the room. | 07:20:47 |
| @rahulranjan:matrix.org left the room. | 08:00:29 |
18 Mar 2025 |
Paarth Shah - Github Maintainer | Sorry, just saw this; you could achieve something similar without the try/except using structural pattern matching:
sortedrooms = {}
for room in roomslist.rooms:
response = await client.space_get_hierarchy(room)
match response.rooms:
case [{"room_type": "m.space", "name": name, "children_state": [{"origin_server_ts": origin_server_ts}, *_]} as room, *_]:
print(room)
sortedrooms[origin_server_ts] = name
print(dict(sorted(sortedrooms.items())))
| 09:31:30 |
Paarth Shah - Github Maintainer | * Sorry, just saw this; you could achieve something similar without the try/except using structural pattern matching:
sortedrooms = {}
for each in roomslist.rooms:
response = await client.space_get_hierarchy(each)
match response.rooms:
case [{"room_type": "m.space", "name": name, "children_state": [{"origin_server_ts": origin_server_ts}, *_]} as room, *_]:
print(room)
sortedrooms[origin_server_ts] = name
print(dict(sorted(sortedrooms.items())))
| 09:33:03 |
Exaltia | thank you, i'll note if for later use! | 14:10:40 |
| @mtrnord:midnightthoughts.space changed their profile picture. | 20:44:27 |
22 Mar 2025 |
| @mtrnord:midnightthoughts.space left the room. | 22:00:36 |
24 Mar 2025 |
| becht.felix joined the room. | 11:37:04 |
28 Mar 2025 |
| sents changed their display name from sents ꙮ to sents. | 07:34:46 |
31 Mar 2025 |
| @jaycool901:matrix.org joined the room. | 04:06:46 |
| @jaycool901:matrix.org left the room. | 04:29:07 |
24 Jun 2019 |
| poljar changed the history visibility to "world_readable" from "shared". | 19:00:49 |
| TravisR joined the room. | 19:04:04 |
| Matrix Traveler (bot) joined the room. | 19:06:33 |