Basic messaging on groups and channels works now

This commit is contained in:
Tulir Asokan
2017-11-16 17:55:47 +02:00
parent 0388c96881
commit e136b14f0f
3 changed files with 54 additions and 12 deletions
+19 -3
View File
@@ -61,9 +61,25 @@ class Portal {
return this.peer.loadAccessHash(this.app, telegramPOV, {portal: this})
}
handleMatrixEvent(evt) {
console.log("Received message from Matrix to portal with room ID", this.roomID)
console.log(evt)
async handleTelegramEvent(sender, evt) {
// TODO handle other content types
sender.sendText(this.roomID, evt.text)
}
async handleMatrixEvent(sender, evt) {
switch(evt.content.msgtype) {
case "m.notice":
case "m.text":
await this.loadAccessHash(sender.telegramPuppet)
sender.telegramPuppet.sendMessage(this.peer, evt.content.body)
break
default:
console.log("Unhandled event:", evt)
}
}
isMatrixRoomCreated() {
return !!this.roomID
}
async createMatrixRoom(telegramPOV) {