Add commands for searching and initiating private chats with users (ref #7)

This commit is contained in:
Tulir Asokan
2017-11-25 14:08:06 +02:00
parent 3b42b17bb7
commit ae71433743
7 changed files with 155 additions and 32 deletions
+10 -1
View File
@@ -122,8 +122,17 @@ class Portal {
return !!this.roomID
}
async createMatrixRoom(telegramPOV, { invite = [] } = {}) {
async createMatrixRoom(telegramPOV, { invite = [], inviteEvenIfNotCreated = true } = {}) {
if (this.roomID) {
if (invite && inviteEvenIfNotCreated) {
const intent = this.peer.type === "user"
? (await this.app.getTelegramUser(this.peer.id)).intent
: this.app.botIntent
for (const userID of invite) {
// TODO check membership before inviting
intent.invite(this.roomID, userID)
}
}
return {
created: false,
roomID: this.roomID,