Add option to bridge notices and command to get relaybot info

This commit is contained in:
Tulir Asokan
2018-02-17 19:16:21 +02:00
parent 2f75fa1cfe
commit 4673546b42
5 changed files with 24 additions and 2 deletions
+15
View File
@@ -32,6 +32,21 @@ async def ping(evt):
return await evt.reply("You're not logged in.")
@command_handler()
async def ping_bot(evt):
if not evt.tgbot:
return await evt.reply("Telegram message relay bot not configured.")
bot_info = await evt.tgbot.client.get_me()
localpart = evt.config.get("bridge.username_template", "telegram_{userid}").format(
userid=bot_info.id)
hs = evt.config["homeserver"]["domain"]
mxid = f"@{localpart}:{hs}"
displayname = bot_info.first_name
return await evt.reply(f"Telegram message relay bot is active: "
+ f"[{displayname}](https://matrix.to/#/{mxid}) (ID {bot_info.id})\n\n"
+ f"To use the bot, simply invite it to a portal room.")
@command_handler(needs_auth=False, management_only=True)
def register(evt):
return evt.reply("Not yet implemented.")