Skip to content

Commit c5d8540

Browse files
committed
Allow passing custom data to /createRoom
1 parent d8e73a0 commit c5d8540

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

mautrix/client/api/rooms.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ async def create_room(
6868
room_version: str = None,
6969
creation_content: RoomCreateStateEventContent | dict[str, JSON] | None = None,
7070
power_level_override: PowerLevelStateEventContent | dict[str, JSON] | None = None,
71+
beeper_auto_join_invites: bool = False,
72+
custom_request_fields: dict[str, Any] | None = None,
7173
) -> RoomID:
7274
"""
7375
Create a new room with various configuration options.
@@ -111,6 +113,10 @@ async def create_room(
111113
power_level_override: The power level content to override in the default power level
112114
event. This object is applied on top of the generated ``m.room.power_levels`` event
113115
content prior to it being sent to the room. Defaults to overriding nothing.
116+
beeper_auto_join_invites: A Beeper-specific extension which auto-joins all members in
117+
the invite array instead of sending invites.
118+
custom_request_fields: Additional fields to put in the top-level /createRoom content.
119+
Non-custom fields take precedence over fields here.
114120
115121
Returns:
116122
The ID of the newly created room.
@@ -124,6 +130,7 @@ async def create_room(
124130
.. _m.room.member: https://spec.matrix.org/v1.1/client-server-api/#mroommember
125131
"""
126132
content = {
133+
**(custom_request_fields or {}),
127134
"visibility": visibility.value,
128135
"is_direct": is_direct,
129136
"preset": preset.value,
@@ -132,6 +139,8 @@ async def create_room(
132139
content["room_alias_name"] = alias_localpart
133140
if invitees:
134141
content["invite"] = invitees
142+
if beeper_auto_join_invites:
143+
content["com.beeper.auto_join_invites"] = True
135144
if name:
136145
content["name"] = name
137146
if topic:

0 commit comments

Comments
 (0)