Commit 3b9fd134 authored by mercury233's avatar mercury233

fix long msg spam

parent 5b95cd02
...@@ -1462,6 +1462,11 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)-> ...@@ -1462,6 +1462,11 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
#when '/test' #when '/test'
# ygopro.stoc_send_hint_card_to_room(room, 2333365) # ygopro.stoc_send_hint_card_to_room(room, 2333365)
if (msg.length>100)
log.warn "SPAM WORD", client.name, client.ip, msg
client.abuse_count=client.abuse_count+2 if client.abuse_count
ygopro.stoc_send_chat(client, "${chat_warn_level0}", ygopro.constants.COLORS.RED)
cancel = true
if !(room and room.random_type) if !(room and room.random_type)
return cancel return cancel
if client.abuse_count>=5 if client.abuse_count>=5
...@@ -1488,11 +1493,6 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)-> ...@@ -1488,11 +1493,6 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
client.rag = false client.rag = false
#ygopro.stoc_send_chat(client, "${chat_warn_level0}", ygopro.constants.COLORS.RED) #ygopro.stoc_send_chat(client, "${chat_warn_level0}", ygopro.constants.COLORS.RED)
cancel = true cancel = true
else if (msg.length>100)
log.warn "SPAM WORD", client.name, client.ip, oldmsg
client.abuse_count=client.abuse_count+2
ygopro.stoc_send_chat(client, "${chat_warn_level0}", ygopro.constants.COLORS.RED)
cancel = true
else if (_.any(settings.ban.spam_word, (badword) -> else if (_.any(settings.ban.spam_word, (badword) ->
regexp = new RegExp(badword, 'i') regexp = new RegExp(badword, 'i')
return msg.match(regexp) return msg.match(regexp)
......
...@@ -1811,6 +1811,14 @@ ...@@ -1811,6 +1811,14 @@
ygopro.stoc_send_chat(client, "${room_name} " + room.name, ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${room_name} " + room.name, ygopro.constants.COLORS.BABYBLUE);
} }
} }
if (msg.length > 100) {
log.warn("SPAM WORD", client.name, client.ip, msg);
if (client.abuse_count) {
client.abuse_count = client.abuse_count + 2;
}
ygopro.stoc_send_chat(client, "${chat_warn_level0}", ygopro.constants.COLORS.RED);
cancel = true;
}
if (!(room && room.random_type)) { if (!(room && room.random_type)) {
return cancel; return cancel;
} }
...@@ -1840,11 +1848,6 @@ ...@@ -1840,11 +1848,6 @@
} else if (client.rag && room.started) { } else if (client.rag && room.started) {
client.rag = false; client.rag = false;
cancel = true; cancel = true;
} else if (msg.length > 100) {
log.warn("SPAM WORD", client.name, client.ip, oldmsg);
client.abuse_count = client.abuse_count + 2;
ygopro.stoc_send_chat(client, "${chat_warn_level0}", ygopro.constants.COLORS.RED);
cancel = true;
} else if (_.any(settings.ban.spam_word, function(badword) { } else if (_.any(settings.ban.spam_word, function(badword) {
var regexp; var regexp;
regexp = new RegExp(badword, 'i'); regexp = new RegExp(badword, 'i');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment