Add option to set related groups for created rooms

This commit is contained in:
Tulir Asokan
2019-06-30 19:04:56 +03:00
parent 860b635188
commit 0f7eebd683
3 changed files with 14 additions and 0 deletions
+4
View File
@@ -60,6 +60,10 @@ appservice:
bot_displayname: Telegram bridge bot
bot_avatar: mxc://maunium.net/tJCRmUyJDsgRNgqhOgoiHWbX
# Community ID for bridged users (changes registration file) and rooms.
# Must be created manually.
community_id: false
# Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
as_token: "This value is generated when generating the registration"
hs_token: "This value is generated when generating the registration"
+5
View File
@@ -189,6 +189,8 @@ class Config(DictWithRecursion):
copy("appservice.bot_displayname")
copy("appservice.bot_avatar")
copy("appservice.community_id")
copy("appservice.as_token")
copy("appservice.hs_token")
@@ -352,3 +354,6 @@ class Config(DictWithRecursion):
"sender_localpart": self["appservice.bot_username"],
"rate_limited": False
}
if self["appservice.community_id"]:
self._registration["namespaces"]["users"][0]["group_id"] \
= self["appservice.community_id"]
+5
View File
@@ -397,6 +397,11 @@ class Portal:
"type": "m.room.power_levels",
"content": power_levels,
}]
if config["appservice.community_id"]:
initial_state.append({
"type": "m.room.related_groups",
"content": {"groups": [config["appservice.community_id"]]},
})
room_id = await self.main_intent.create_room(alias=alias, is_public=public,
is_direct=direct, invitees=invites or [],