Ensure user is registered and joined

This commit is contained in:
Half-Shot 2020-02-26 15:50:40 +00:00
parent 445a033e71
commit 13108cd51c
2 changed files with 4 additions and 2 deletions

View File

@ -233,8 +233,9 @@ export class GithubBridge {
return;
}
log.info(`Bridge bot joined ${roomId}`);
const bridgeStateEvents: IBridgeRoomState[] =
(await this.as.botClient.getRoomState(roomId)).filter((ev) =>
const stateEvs = await this.as.botClient.getRoomState(roomId);
console.log(stateEvs);
const bridgeStateEvents: IBridgeRoomState[] = stateEvs.filter((ev) =>
ev.type === BRIDGE_STATE_TYPE,
);

View File

@ -48,6 +48,7 @@ export class MatrixSender {
public async sendMatrixMessage(messageId: string, msg: IMatrixSendMessage) {
const intent = msg.sender ? this.as.getIntentForUserId(msg.sender) : this.as.botIntent;
await intent.ensureRegisteredAndJoined(msg.roomId);
const eventId = await intent.underlyingClient.sendEvent(msg.roomId, msg.type, msg.content);
log.info("Sent", eventId);
await this.mq.push<IMatrixSendMessageResponse>({