diff --git a/index.js b/index.js index 213b843..fcf4796 100644 --- a/index.js +++ b/index.js @@ -127,7 +127,14 @@ Searxng.prototype.handleMessage = function(event, room) { return; } else if (this.roomUserWhitelists.has(room.roomId) && this.roomUserWhitelists.get(room.roomId).indexOf(event.getSender()) < 0) { - this.matrixClient.sendNotice(room.roomId, "You are not on the whitelist for this room."); + const lastRoomWarningTime = lastWarningTimes.get(room.roomId); + + const currentTime = Date.now(); + + if (isNaN(lastRoomWarningTime) || (Date.now() - lastRoomWarningTime) > 10000) { + this.matrixClient.sendNotice(room.roomId, "You are not on the whitelist for this room."); + lastWarningTimes.set(room.roomId, currentTime); + } return; } else if (this.cooldownImmuneUsers.indexOf(event.getSender()) < 0) {