update tests
This commit is contained in:
11
src/bot.js
11
src/bot.js
@@ -14,7 +14,6 @@ import logger from "./logger";
|
||||
class OcrccBot {
|
||||
constructor(botConfig) {
|
||||
this.config = botConfig
|
||||
this.awaitingFacilitator = {};
|
||||
this.client = matrix.createClient(this.config.MATRIX_SERVER_URL);
|
||||
this.joinedRooms = [];
|
||||
}
|
||||
@@ -146,11 +145,15 @@ class OcrccBot {
|
||||
const groupUsers = await this.client.getGroupUsers(this.config.FACILITATOR_GROUP_ID)
|
||||
const roomMembers = await this.client.getJoinedRoomMembers(roomId)
|
||||
|
||||
const membersIds = Object.keys(roomMembers["joined"]);
|
||||
const facilitatorsIds = groupUsers.chunk.map(f => f.user_id);
|
||||
const roomMemberIds = Object.keys(roomMembers["joined"]);
|
||||
const groupMemberIds = groupUsers["chunk"]
|
||||
|
||||
if (!roomMemberIds || !groupMemberIds) return;
|
||||
|
||||
const facilitatorsIds = groupMemberIds.map(f => f.user_id);
|
||||
|
||||
facilitatorsIds.forEach(f => {
|
||||
if (!membersIds.includes(f)) {
|
||||
if (!roomMemberIds.includes(f)) {
|
||||
this.kickUserFromRoom(roomId, f);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user