File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,25 @@ export class BotSDKBaseClient
169169 return await resolveRoomReferenceSafe ( this . client , roomReference ) ;
170170 }
171171
172+ public async inviteUser (
173+ room : MatrixRoomID | StringRoomID ,
174+ userID : StringUserID ,
175+ reason ?: string
176+ ) : Promise < ActionResult < void > > {
177+ const roomID = room instanceof MatrixRoomID ? room . toRoomIDOrAlias ( ) : room ;
178+ return await this . client
179+ . doRequest (
180+ 'POST' ,
181+ `/_matrix/client/v3/rooms/${ encodeURIComponent ( roomID ) } /invite` ,
182+ null ,
183+ {
184+ user_id : userID ,
185+ ...( reason ? { reason } : { } ) ,
186+ }
187+ )
188+ . then ( ( _ ) => Ok ( undefined ) , resultifyBotSDKRequestError ) ;
189+ }
190+
172191 public async joinRoom (
173192 room : MatrixRoomReference | StringRoomID | StringRoomAlias ,
174193 rawOptions ?: { alwaysCallJoin ?: boolean }
Original file line number Diff line number Diff line change 88 RoomCreator ,
99 RoomEventRedacter ,
1010 RoomEventRelationsGetter ,
11+ RoomInviter ,
1112 RoomJoiner ,
1213 RoomKicker ,
1314 RoomMessageSender ,
@@ -36,6 +37,9 @@ export class BotSDKClientPlatform implements ClientPlatform {
3637 toRoomCreator ( ) : RoomCreator {
3738 return this . allClient ;
3839 }
40+ toRoomInviter ( ) : RoomInviter {
41+ return this . allClient ;
42+ }
3943 toRoomJoiner ( ) : RoomJoiner {
4044 return this . allClient ;
4145 }
You can’t perform that action at this time.
0 commit comments