const filters = ["nique","mere","fdp","ntm","pute","enculé","noob","suceuse","suceur","suce","bite","nul","pd","PD","gueule","négros","Fdp","fDp","fdP"];
const prefix = ["-"];
function getAllStrings(list, prefix) {
return list
.filter(_=>_.startsWith(prefix))
.map(_=>_.substring(prefix.length));
}
world.beforeEvents.chatSend.subscribe((data) => {
const { message, sender } = data;
data.cancel = true;
if (prefix.some(w => message.includes(w))) return
if (filters.some(w => message.includes(w))) return sender.sendMessage('§cPas Bien De Ecrire Sa')
const tags = sender.getTags();
let ranks = getAllStrings(tags, "rank:");
let nickname = getAllStrings(tags, "psn:");
ranks = ranks.length ? ranks : ["§bJoueur"]
nickname = nickname.length ? nickname : [`${sender.nameTag}`];
world.sendMessage(`§e${nickname}§f > ${message}`)
});
#quick question how can I have all the insults in the world for a chat filter?
1 messages · Page 1 of 1 (latest)
You probably are going to have to use linguistics but idk if its even worth the time and performance cost
You need help from a british person
Why is "noob" an insult?
no but people don't like them so I blacklist them
You can use an api but it won't return a list with all bad words in the world
It will only tell you if the message has a bad word in it
And maybe what it was
Isn't there a list with a lot of bad words?
Yeah, its called british dictionary
where are you really making fun of me? 🙂
small question possible to make sure that there is a certain character that can be written?? in a chat?
Minecraft itself has a words blacklist
I think it was inside the apk
I saw it long ago
ha
.
if (!tout.some(w => message.includes(w))) return //sender.message(`Tu A Le Droit De Ecrire Qu'Avec [${tout}]`)
?
const LetreMaj = ["ABCDEFGHIJKLMOPQRSTUVWXYZ"];
const LetreMin = ["abcdefghijklmnopqrstuvwxyz"];
const number = ["0123456789"];
const symbol = ["?."];
const tout = LetreMaj + LetreMin + number + symbol;
Do you think I can do that can only write with c letter and c symbol otherwise he can't write?
Also, tout would be a string
I want who can write that with it's letter in symbol no more c possible?,
?
You want to detect if someone uses a simbol/letter that is not in that list?
If you use the + operator in string arrays, they will become a single string
yes
that's what I want if the letters which are not in the list he cannot write
const LetreMaj = ["ABCDEFGHIJKLMOPQRSTUVWXYZ"];
const LetreMin = ["abcdefghijklmnopqrstuvwxyz"];
const number = ["0123456789"];
const symbol = ["?."];
const tout = LetreMaj + LetreMin + number + symbol;
const filters = ["nique","mere","fdp","ntm","pute","enculé","noob","suceuse","suceur","suce","bite","nul","pd","PD","gueule","négros","Fdp","fDp","fdP"];
const prefix = ["-"];
const pub = ["discord.gg","dsc.gg","niggers","kys","@outlook.com","@gmail.com","@hotmail.com","discordapp.com","§k","https://","http://"]
function getAllStrings(list, prefix) {
return list
.filter(_=>_.startsWith(prefix))
.map(_=>_.substring(prefix.length));
}
world.beforeEvents.chatSend.subscribe((data) => {
const { message, sender } = data;
data.cancel = true;
if (!tout.some(w => message.includes(w))) return //sender.message(`Tu A Le Droit De Ecrire Qu'Avec [${tout}]`)
if (message.length <= 3) return sender.sendMessage('§aMessage Trop Court (min 3 lettre)')
if (pub.some(w => message.includes(w))) return sender.sendMessage('§cPas Bien De Faire Sa Pub')
if (prefix.some(w => message.includes(w))) return
if (filters.some(w => message.includes(w))) return sender.sendMessage('§cPas Bien De Ecrire Sa')
const tags = sender.getTags();
let nickname = getAllStrings(tags, "psn:");
ranks = ranks.length ? ranks : ["§bJoueur"]
nickname = nickname.length ? nickname : [`${sender.nameTag}`];
world.sendMessage(`§e${nickname}§f > ${message}`)
});
const matches = message.match(/[^A-z0-9?.\s]/g);
if (!matches) return;
Ok now its better
matches is a string list with all the characters that are not a letter/number/? or . simbol
th man
\u00C0 ??
can I remove it?
If you want
\u017F ??
It works as a set, that means \u00C0 is the first acentuated letter and \u017F is the last one
So you need to remove both
I removed it
ok
moi je cherche la même script mais avec un anti spamen plus
dit moi en plus
si un joueur envois plus de 3 fois le même message sa le suprime et sa lui dit que sais pas bien de spam
et aussi je sais pas si tu peux m'aide car je cherche un script qui quand un joueur n'a pas d'armure il peux pas prendre de damage et ne peux pas taper des joueur
c'est dans le player.json sa
avec un scoreboard ?
jsp
lol
world.beforeEvents.chatSend.subscribe(r => {
const scorechat = world.scoreboard.getObjective('timechat')
const { sender: player, message } = r
r.cancel = true
if (message.startsWith(prefix)) return
if (player.hasTag('muted')) return player.sendMessage(`§cVous êtes muté, vous ne pouvez pas parler.`)
if (scorechat.getScore(player) > 0) return player.sendMessage(`Message trop Vite ${scorechat.getScore(player)}sec`)
system.run(() => {scorechat.setScore(player,5)})
world.sendMessage(`<${player.name}> ${message}`)
})
merci
cree un scoreboard timechat ajoute 0 a tout le monde avec tu fait un truc qui retire 1 a tout le monde tous les seconde
oki
non car sais pas un tag
bas tu peux faire que si il a un certain tag sa fait que les demage et taper son inactif
oui et meme sa vas pas car sur mon serveur j'utilise un gamerul pvp con je peux pas l'utiliser car sais bug