#quick question how can I have all the insults in the world for a chat filter?

1 messages · Page 1 of 1 (latest)

vivid coral
#
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}`)
});
strong drum
silent lake
#

You need help from a british person

vivid coral
silent lake
#

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

vivid coral
silent lake
#

Yeah, its called british dictionary

vivid coral
#

small question possible to make sure that there is a certain character that can be written?? in a chat?

silent lake
#

Minecraft itself has a words blacklist

#

I think it was inside the apk

#

I saw it long ago

vivid coral
vivid coral
#
if (!tout.some(w => message.includes(w))) return //sender.message(`Tu A Le Droit De Ecrire Qu'Avec [${tout}]`)
silent lake
#

?

vivid coral
#
const LetreMaj = ["ABCDEFGHIJKLMOPQRSTUVWXYZ"];
const LetreMin = ["abcdefghijklmnopqrstuvwxyz"];
const number = ["0123456789"];
const symbol = ["?."];

const tout = LetreMaj + LetreMin + number + symbol;
vivid coral
# silent lake ?

Do you think I can do that can only write with c letter and c symbol otherwise he can't write?

silent lake
#

What do you mean by that?

#

Like.... I can write if I do: "C hello"?

vivid coral
#

I want who can write that with it's letter in symbol no more c possible?,

vivid coral
silent lake
#

You want to detect if someone uses a simbol/letter that is not in that list?

silent lake
# vivid coral ?

If you use the + operator in string arrays, they will become a single string

vivid coral
#

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}`)
});
silent lake
#
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

silent lake
#

Thats for letter with acentuation

#

Like "á"

vivid coral
#

can I remove it?

silent lake
#

If you want

vivid coral
#

\u017F ??

silent lake
#

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

vivid coral
#

ok

weak wraith
vivid coral
weak wraith
weak wraith
# vivid coral dit moi en plus

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

weak wraith
quaint basin
vivid coral
# weak wraith jsp
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}`)
})
vivid coral
#

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

weak wraith
vivid coral
weak wraith