From fac337eaf1b1be334d8d4977c296d081117a8a2a Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Fri, 22 Oct 2021 12:17:25 -0400 Subject: [PATCH 1/3] Add example config for welcome messages. --- mautrix_telegram/example-config.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mautrix_telegram/example-config.yaml b/mautrix_telegram/example-config.yaml index 7b429210..c64a1a19 100644 --- a/mautrix_telegram/example-config.yaml +++ b/mautrix_telegram/example-config.yaml @@ -394,6 +394,21 @@ bridge: # The prefix for commands. Only required in non-management rooms. command_prefix: "!tg" + # Messages sent upon joining a management room. + # Markdown is supported. The defaults are listed below. + management_room_text: + # Sent when joining a room. + welcome: "Hello, I'm a Telegram bridge bot." + # Sent when joining a management room and the user is already logged in. + welcome_connected: "Use `help` for help." + # Sent when joining a management room and the user is not logged in. + welcome_unconnected: "Use `help` for help or `login` to log in." + # Optional extra text sent when joining a management room. + # additional_help: "This would be some additional text in case you need it." + + # Send each message separately (for readability in some clients) + management_room_multiple_messages: false + # Permissions for using the bridge. # Permitted values: # relaybot - Only use the bridge via the relaybot, no access to commands. From 2c45d8dd5be67d95fac21312ef4c9213df6e9ffa Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Sat, 23 Oct 2021 12:09:16 -0400 Subject: [PATCH 2/3] Remove send_welcome_message override --- mautrix_telegram/matrix.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/mautrix_telegram/matrix.py b/mautrix_telegram/matrix.py index 2813c988..be177ef4 100644 --- a/mautrix_telegram/matrix.py +++ b/mautrix_telegram/matrix.py @@ -115,23 +115,6 @@ async def handle_puppet_invite(self, room_id: RoomID, puppet: pu.Puppet, inviter await intent.send_notice(room_id, "This puppet will remain inactive until a " "Telegram chat is created for this room.") - async def send_welcome_message(self, room_id: RoomID, inviter: 'u.User') -> None: - try: - is_management = len(await self.az.intent.get_room_members(room_id)) == 2 - except MatrixError: - # The AS bot is not in the room. - return - cmd_prefix = self.commands.command_prefix - text = html = "Hello, I'm a Telegram bridge bot. " - if is_management and inviter.puppet_whitelisted and not await inviter.is_logged_in(): - text += f"Use `{cmd_prefix} help` for help or `{cmd_prefix} login` to log in." - html += (f"Use {cmd_prefix} help for help" - f" or {cmd_prefix} login to log in.") - else: - text += f"Use `{cmd_prefix} help` for help." - html += f"Use {cmd_prefix} help for help." - await self.az.intent.send_notice(room_id, text=text, html=html) - async def handle_invite(self, room_id: RoomID, user_id: UserID, inviter: 'u.User', event_id: EventID) -> None: user = u.User.get_by_mxid(user_id, create=False) From 8aecf1f84b6c04ecc5864f121f278a7afa5bb3f7 Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Sat, 23 Oct 2021 12:10:36 -0400 Subject: [PATCH 3/3] Update example config. --- mautrix_telegram/example-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mautrix_telegram/example-config.yaml b/mautrix_telegram/example-config.yaml index c64a1a19..028cce7f 100644 --- a/mautrix_telegram/example-config.yaml +++ b/mautrix_telegram/example-config.yaml @@ -404,7 +404,7 @@ bridge: # Sent when joining a management room and the user is not logged in. welcome_unconnected: "Use `help` for help or `login` to log in." # Optional extra text sent when joining a management room. - # additional_help: "This would be some additional text in case you need it." + additional_help: "" # Send each message separately (for readability in some clients) management_room_multiple_messages: false