Add option to set related groups for created rooms
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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 [],
|
||||
|
||||
Reference in New Issue
Block a user