Make telegram_link_preview configurable per-room. Fixes #244 again

This commit is contained in:
Tulir Asokan
2018-12-20 15:31:05 +02:00
parent e970dadb6f
commit c589f34986
2 changed files with 3 additions and 3 deletions
+1
View File
@@ -458,6 +458,7 @@ def config_defaults(evt: CommandEvent) -> Awaitable[Dict]:
"native_stickers": evt.config["bridge.native_stickers"],
"message_formats": evt.config["bridge.message_formats"],
"state_event_formats": evt.config["bridge.state_event_formats"],
"telegram_link_preview": evt.config["bridge.telegram_link_preview"],
}, stream)
return evt.reply(f"Bridge instance wide config:\n\n```yaml\n{stream.getvalue()}```")
+2 -3
View File
@@ -98,7 +98,6 @@ class Portal:
public_portals = False # type: bool
max_initial_member_sync = -1 # type: int
sync_channel_members = True # type: bool
tg_link_preview = True # type: bool
dedup_pre_db_check = False # type: bool
dedup_cache_queue_length = 20 # type: int
@@ -918,9 +917,10 @@ class Portal:
reply_to: TelegramID) -> None:
lock = self.require_send_lock(sender_id)
async with lock:
lp = self.get_config("telegram_link_preview")
response = await client.send_message(self.peer, message, reply_to=reply_to,
parse_mode=self._matrix_event_to_entities,
link_preview=self.tg_link_preview)
link_preview=lp)
self._add_telegram_message_to_db(event_id, space, response)
async def _handle_matrix_file(self, msgtype: str, sender_id: TelegramID,
@@ -1877,7 +1877,6 @@ def init(context: Context) -> None:
Portal.filter_list = config["bridge.filter.list"]
Portal.dedup_pre_db_check = config["bridge.deduplication.pre_db_check"]
Portal.dedup_cache_queue_length = config["bridge.deduplication.cache_queue_length"]
Portal.tg_link_preview = config["bridge.telegram_link_preview"]
Portal.alias_template = config.get("bridge.alias_template", "telegram_{groupname}")
Portal.hs_domain = config["homeserver.domain"]
Portal.mx_alias_regex = re.compile(