From 05dfe8c4a384c435c363d5790ce73f69aab634c1 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 11 Feb 2019 22:32:10 +0200 Subject: [PATCH] Fix letters in clean-rooms and add !tg id command --- mautrix_telegram/commands/clean_rooms.py | 6 +++--- mautrix_telegram/commands/portal.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mautrix_telegram/commands/clean_rooms.py b/mautrix_telegram/commands/clean_rooms.py index a3a089ba..0dfb0494 100644 --- a/mautrix_telegram/commands/clean_rooms.py +++ b/mautrix_telegram/commands/clean_rooms.py @@ -70,7 +70,7 @@ async def clean_rooms(evt: CommandEvent) -> Optional[Dict]: for n, (room, other_member) in enumerate(management_rooms)] or ["No management rooms found."]) reply.append("#### Active portal rooms (A)") - reply += ([f"{n+1}. [P{n+1}](https://matrix.to/#/{portal.mxid}) " + reply += ([f"{n+1}. [A{n+1}](https://matrix.to/#/{portal.mxid}) " f"(to Telegram chat \"{portal.title}\")" for n, portal in enumerate(portals)] or ["No active portal rooms found."]) @@ -79,7 +79,7 @@ async def clean_rooms(evt: CommandEvent) -> Optional[Dict]: for n, room in enumerate(unidentified_rooms)] or ["No unidentified rooms found."]) reply.append("#### Inactive portal rooms (I)") - reply += ([f"{n}. [E{n}](https://matrix.to/#/{portal.mxid}) " + reply += ([f"{n}. [I{n}](https://matrix.to/#/{portal.mxid}) " f"(to Telegram chat \"{portal.title}\")" for n, portal in enumerate(empty_portals)] or ["No inactive portal rooms found."]) @@ -93,7 +93,7 @@ async def clean_rooms(evt: CommandEvent) -> Optional[Dict]: "", ("To clean specific rooms, type `$cmdprefix+sp clean-range ` " "where `range` is the range (e.g. `5-21`) prefixed with the first letter of" - "the group name."), + "the group name. (e.g. `I2-6`)"), "", ("Please note that you will have to re-run `$cmdprefix+sp clean-rooms` " "between each use of the commands above.")] diff --git a/mautrix_telegram/commands/portal.py b/mautrix_telegram/commands/portal.py index 8509a09e..84ad61b0 100644 --- a/mautrix_telegram/commands/portal.py +++ b/mautrix_telegram/commands/portal.py @@ -67,6 +67,16 @@ async def sync_state(evt: CommandEvent) -> Dict: await evt.reply("Synchronization complete") +@command_handler(needs_admin=False, needs_puppeting=False, needs_auth=False, + help_section=SECTION_MISC, + help_text="Get the ID of the Telegram chat where this room is bridged.") +async def id(evt: CommandEvent) -> Dict: + portal = po.Portal.get_by_mxid(evt.room_id) + if not portal: + return await evt.reply("This is not a portal room.") + await evt.reply(f"This room is bridged to Telegram chat ID `{portal.tgid}`.") + + @command_handler(help_section=SECTION_PORTAL_MANAGEMENT, help_text="Get a Telegram invite link to the current chat.") async def invite_link(evt: CommandEvent) -> Dict: