Invite all users sent in initial group create action
This commit is contained in:
+14
-10
@@ -146,16 +146,7 @@ class Portal {
|
|||||||
switch (evt.action._) {
|
switch (evt.action._) {
|
||||||
case "messageActionChatCreate":
|
case "messageActionChatCreate":
|
||||||
await this.createMatrixRoom(evt.source, { invite: [evt.source.matrixUser.userID] })
|
await this.createMatrixRoom(evt.source, { invite: [evt.source.matrixUser.userID] })
|
||||||
break
|
// Falls through to invite everyone in initial user list
|
||||||
case "messageActionChatDeleteUser":
|
|
||||||
matrixUser = await this.app.getMatrixUserByTelegramID(evt.action.user_id)
|
|
||||||
if (matrixUser) {
|
|
||||||
matrixUser.leave(this)
|
|
||||||
this.kick(matrixUser.userID, "Left Telegram chat")
|
|
||||||
}
|
|
||||||
telegramUser = await this.app.getTelegramUser(evt.action.user_id)
|
|
||||||
telegramUser.intent.leave(this.roomID)
|
|
||||||
break
|
|
||||||
case "messageActionChatAddUser":
|
case "messageActionChatAddUser":
|
||||||
for (const userID of evt.action.users) {
|
for (const userID of evt.action.users) {
|
||||||
matrixUser = await this.app.getMatrixUserByTelegramID(userID)
|
matrixUser = await this.app.getMatrixUserByTelegramID(userID)
|
||||||
@@ -167,6 +158,19 @@ class Portal {
|
|||||||
telegramUser.intent.join(this.roomID)
|
telegramUser.intent.join(this.roomID)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case "messageActionChannelCreate":
|
||||||
|
// Channels don't send initial user lists 3:<
|
||||||
|
await this.createMatrixRoom(evt.source, { invite: [evt.source.matrixUser.userID] })
|
||||||
|
break
|
||||||
|
case "messageActionChatDeleteUser":
|
||||||
|
matrixUser = await this.app.getMatrixUserByTelegramID(evt.action.user_id)
|
||||||
|
if (matrixUser) {
|
||||||
|
matrixUser.leave(this)
|
||||||
|
this.kick(matrixUser.userID, "Left Telegram chat")
|
||||||
|
}
|
||||||
|
telegramUser = await this.app.getTelegramUser(evt.action.user_id)
|
||||||
|
telegramUser.intent.leave(this.roomID)
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
console.log("Unhandled service message of type", evt.action._)
|
console.log("Unhandled service message of type", evt.action._)
|
||||||
console.log(evt.action)
|
console.log(evt.action)
|
||||||
|
|||||||
Reference in New Issue
Block a user