mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
feat: server chat filter for slurs and sexual talk, no secret valentines
- lib/chatfilter.js reads its rules from lib/chat-filter.txt (reloaded when it changes) and applies them to typed chat, jam-a-gram messages and jammer wall posts. players cannot turn it off. a blocked message reaches nobody, its sender sees the game's "inappropriate behavior" warning, and blocked chat is kept in the chat log marked not sent. - rules match words, prefixes and phrases, in order or anywhere, with "?" for any word and "!" for exceptions, and see through stand-in letters, drawn-out letters and spaced-out spelling. the example rules block sexual talk aimed at someone while letting plain swearing through; the slur section is left for the owner to fill in. - secret valentine jam-a-grams are off: the client sends a normal card without asking (buildVersion 56), and the server refuses a card asked for as a secret valentine.
This commit is contained in:
1 parent
aa455f52d0
commit
89fe4d2a28
8 files changed
+291
-6
No files matched your search
+17
-2
@@ -4,6 +4,7 @@ const fs = require("fs");
|
||||
const path = require("path");
|
||||
const accounts = require("./accounts.js");
|
||||
const achievements = require("./achievements.js");
|
||||
const chatFilter = require("./chatfilter.js");
|
||||
const defpacks = require("./defpacks.js");
|
||||
const dens = require("./dens.js");
|
||||
const limits = require("./limits.js");
|
||||
@@ -248,6 +249,21 @@ module.exports = ({findOnline, blocks}) => {
|
||||
reply(FAILED);
|
||||
return;
|
||||
}
|
||||
// secret valentines are off on this server: the patched client no
|
||||
// longer offers them, and a card asked for as one from an older copy
|
||||
// is not sent with its sender's name shown instead.
|
||||
if (isValentine === "1") {
|
||||
reply(FAILED);
|
||||
return;
|
||||
}
|
||||
// the server's filter (lib/chatfilter.js).
|
||||
const rule = chatFilter.broken(clean(message || ""));
|
||||
if (rule) {
|
||||
chatFilter.warn(session);
|
||||
console.log(`[filter] ${account.username} in a Jam-a-Gram to ${to.username}: "${clean(message || "")}" (${rule})`);
|
||||
reply(FAILED);
|
||||
return;
|
||||
}
|
||||
if (!mayReceiveFrom(to, account)) {
|
||||
reply(NOT_ACCEPTING);
|
||||
return;
|
||||
@@ -262,8 +278,7 @@ module.exports = ({findOnline, blocks}) => {
|
||||
reply(FAILED);
|
||||
return;
|
||||
}
|
||||
deliver(to, {from: account.username, fromId: account.id, card: Number(card), stamp: Number(stamp), msg: clean(message || ""), gift,
|
||||
...(isValentine === "1" ? {secret: true} : {})});
|
||||
deliver(to, {from: account.username, fromId: account.id, card: Number(card), stamp: Number(stamp), msg: clean(message || ""), gift});
|
||||
achievements.add(account, achievements.VARS.jamAGramsSent);
|
||||
if (gift) {
|
||||
achievements.add(account, achievements.VARS.giftsSent);
|
||||
|
||||
Reference in new issue
Block a user