Add initial blocking of new users in chat
This commit is contained in:
parent
6245dc84da
commit
701d470494
4 changed files with 48 additions and 1 deletions
|
|
@ -131,6 +131,21 @@ ChatModule.prototype.handleChatMsg = function (user, data) {
|
|||
|
||||
// Limit to 240 characters
|
||||
data.msg = data.msg.substring(0, 240);
|
||||
|
||||
const firstSeen = user.getFirstSeenTime();
|
||||
// TODO: configurable times
|
||||
if (firstSeen > Date.now() - 5 * 60 * 1000) {
|
||||
user.socket.emit("spamFiltered", {
|
||||
reason: "NEW_USER_CHAT"
|
||||
});
|
||||
return;
|
||||
} else if ((firstSeen > Date.now() - 24 * 60 * 60 * 1000) && data.msg.match(LINK)) {
|
||||
user.socket.emit("spamFiltered", {
|
||||
reason: "NEW_USER_CHAT_LINK"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// If channel doesn't permit them, strip ASCII control characters
|
||||
if (!this.channel.modules.options ||
|
||||
!this.channel.modules.options.get("allow_ascii_control")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue