forked from fair/matrix-puppeteer-line
List contacts alphabetically
This commit is contained in:
parent
f39781cdcc
commit
0dd2cf60b1
|
@ -26,6 +26,7 @@ SECTION_CHATS = HelpSection("Contacts & Chats", 40, "")
|
||||||
async def list_contacts(evt: CommandEvent) -> None:
|
async def list_contacts(evt: CommandEvent) -> None:
|
||||||
# TODO Use a generator if it's worth it
|
# TODO Use a generator if it's worth it
|
||||||
puppets = await pu.Puppet.get_all()
|
puppets = await pu.Puppet.get_all()
|
||||||
|
puppets.sort(key=lambda puppet: puppet.name)
|
||||||
results = "".join(f"* [{puppet.name}](https://matrix.to/#/{puppet.default_mxid})\n"
|
results = "".join(f"* [{puppet.name}](https://matrix.to/#/{puppet.default_mxid})\n"
|
||||||
for puppet in puppets)
|
for puppet in puppets)
|
||||||
if results:
|
if results:
|
||||||
|
|
Loading…
Reference in New Issue