Add delay to whitelist warning message to prevent spamming
This commit is contained in:
parent
49b80f6323
commit
e89c970053
2
index.js
2
index.js
@ -131,7 +131,7 @@ Searxng.prototype.handleMessage = function(event, room) {
|
|||||||
|
|
||||||
const currentTime = Date.now();
|
const currentTime = Date.now();
|
||||||
|
|
||||||
if (isNaN(lastRoomWarningTime) || (Date.now() - lastRoomWarningTime) > 10000) {
|
if (isNaN(lastRoomWarningTime) || (currentTime - lastRoomWarningTime) > 10000) {
|
||||||
this.matrixClient.sendNotice(room.roomId, "You are not on the whitelist for this room.");
|
this.matrixClient.sendNotice(room.roomId, "You are not on the whitelist for this room.");
|
||||||
lastWarningTimes.set(room.roomId, currentTime);
|
lastWarningTimes.set(room.roomId, currentTime);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user