Détecteur de spams et de vulgarités (en dialog)

Contenu du snippet

comme le titre l'indique, sa sert à détecter le spam et la vulgarités. Si un mot que vous avez censurez est dit, cela vous prévient par notice et sa vous présente plusieurs choix d'interventions par le biais des Fkeys F1, F2, F3, F4 et F5. Ces Fkeys seront actifs le temps préalablement choisis. Voilà :

Source / Exemple :


;----> à mettre dans la partie remote :

dialog ecranprincipal {
  title "       <---- [ détecteur de spam & de vulgarités ] ---->   /!\ à consommer avec modération /!\"
  size -1 -1 300 292
  button "",50, 100 100 1 1,ok  
  option dbu
  box "option générale", 1, 10 10 280 175
  check "activer/désactiver le détecteur", 2, 16 18 97 10, group
  radio "seulement lorsqu'il y a spam", 3, 150 36 108 10, group
  box "me prévenir ...", 4, 124 14 152 92
  check "tout le temps", 5, 141 21 50 10, group
  radio "seulement lorsqu'il y a vulgarités", 6, 150 49 108 10, group
  text "entrer le message souhaité pour être prévenu(e)", 7, 129 66 142 8, group center
  edit "", 8, 129 80 142 10, group autohs
  text "durée pendant laquelle je peux agir (avertir, kicker, bannir)", 10, 15 112 173 8, group
  edit "", 11, 194 111 11 10, autohs
  icon 12, 16 31 100 74
  text "avertir d'un kick imminent", 15, 15 136 95 8
  text "avertir d'un ban imminent", 16, 15 160 95 8
  text "avertir que ce mot est censuré", 17, 15 124 95 8
  text "raison du kick", 18, 15 148 95 8
  text "raison du ban", 19, 15 172 95 8
  edit "", 20, 116 123 167 10, autohs
  edit "", 21, 116 135 167 10, autohs
  edit "", 22, 116 147 167 10, autohs
  edit "", 23, 116 159 167 10, autohs
  edit "", 24, 116 171 167 10, autohs
  text "liste des mots censurés pour le spam", 25, 22 187 109 8
  text "liste des mots censurés pour la vulgarité", 26, 168 187 128 8
  button "ajouter", 27, 30 267 37 12
  button "supprimer", 28, 72 267 37 12
  button "ajouter", 29, 195 267 37 12
  button "supprimer", 30, 237 267 37 12
  list 31, 29 198 94 55, size hsbar vsbar
  edit "", 32, 8 256 136 10, autohs
  list 33, 178 198 94 55, size hsbar vsbar
  edit "", 34, 157 256 136 10, autohs
  button "ok", 41, 113 279 37 12 
  button "annuler", 42, 153 279 37 12
}

on *:dialog:ecranprincipal:init:*: {
  { /loadbuf $+(1-,$lines(listspam.txt)) -o ecranprincipal 31 listspam.txt }
  { /loadbuf $+(1-,$lines(listvulgaire.txt)) -o ecranprincipal 33 listvulgaire.txt }
  { /loadbuf 1-1 -o ecranprincipal 8 listreste.txt }
  { /loadbuf 2-2 -o ecranprincipal 20 listreste.txt }
  { /loadbuf 3-3 -o ecranprincipal 21 listreste.txt }
  { /loadbuf 4-4 -o ecranprincipal 22 listreste.txt }
  { /loadbuf 5-5 -o ecranprincipal 23 listreste.txt }
  { /loadbuf 6-6 -o ecranprincipal 24 listreste.txt }
  { /loadbuf 7-7 -o ecranprincipal 11 listreste.txt }
  if (%cocher == s) { /did -c ecranprincipal 3 }
  if (%cocher == sv) { /did -c ecranprincipal 3,6,5 }
  if (%cocher == v) { /did -c ecranprincipal 6 }
  if (%active == 1) { /did -c ecranprincipal 2 | .enable #listmotcensure }
  if (%active == 0) { .disable #listmotcensure }
}

on *:dialog:ecranprincipal:sclick:*: {   

  ;me prevenir 
  if ($did == 2) {
    if ($did(2).state == 1) { .enable #listmotcensure | /set %active 1 }
    else { .disable #listmotcensure | /set %active 0 }
  }
  ;solo spam
  if ($did == 3) { /did -u ecranprincipal 5,6 | /set %cocher s }
  ;tout le temps  
  if ($did == 5) { /did -c ecranprincipal 3,6 | /set %cocher sv }
  ;solo vulgarités
  if ($did == 6) { /did -u ecranprincipal 3,5 | /set %cocher v }
  ;être prévenu(e), avertissements mots censuré, avertissement kick imminent, raison kick, avertissement ban imminent, raison ban, duree action
  if ($did == 41) {
    write -l1 listreste.txt $did(8).text | .timerprevenue 1 0 set %meprevenir $read(listreste.txt,1) | write -l2 listreste.txt $did(20).text | .timermotcensure 1 0 set %avertirmotcensure $read(listreste.txt,2) | write -l3 listreste.txt $did(21).text | .timeravertirkick 1 0 set %avertirkick $read(listreste.txt,3) | write -l4 listreste.txt $did(22).text | .timerkick 1 0 set %raisonkick $read(listreste.txt,4) | write -l5 listreste.txt $did(23).text | .timeravertirban 1 0 set %avertirban $read(listreste.txt,5) | write -l6 listreste.txt $did(24).text | .timerraisonban 1 0 set %raisonban $read(listreste.txt,6) | write -l7 listreste.txt $did(11).text  | .timerdureaction 1 0 set %dureaction $read(listreste.txt,7) | dialog -x ecranprincipal ecranprincipal 

  }
  ;listspam 
  if ($did == 31) { /did -r ecranprincipal 32 | /did -a ecranprincipal 32 $did(31).seltext }
  if (($did == 27) && ($did(32).text != $null)) { /did -a ecranprincipal 31 $did(32) | /did -r ecranprincipal 32 | /savebuf -o 1-1000000 ecranprincipal 31 listspam.txt } 
  if (($did == 28) && ($did(32).text != $null)) { /set %motspam $did(32).text | /set %lignespam $didwm(ecranprincipal,31,%motspam) | /did -d ecranprincipal 31 %lignespam %motspam | /did -r ecranprincipal 32 | /write -c listspam.txt | /savebuf -o 1-1000000 ecranprincipal 31 listspam.txt }
  ;listvulgaire
  if ($did == 33) { /did -r ecranprincipal 34 | /did -a ecranprincipal 34 $did(33).seltext }
  if (($did == 29) && ($did(34).text != $null)) { /did -a ecranprincipal 33 $did(34) | /did -r ecranprincipal 34 | /savebuf -o 1-1000000 ecranprincipal 33 listvulgaire.txt } 
  if (($did == 30) && ($did(34).text != $null)) { /set %motspam $did(34).text | /set %lignespam $didwm(ecranprincipal,33,%motspam) | /did -d ecranprincipal 33 %lignespam %motspam | /did -r ecranprincipal 34 | /write -c listvulgaire.txt | /savebuf -o 1-1000000 ecranprincipal 33 listvulgaire.txt }
  ;annuler
  if ($did == 42) { /dialog -x ecranprincipal ecranprincipal }
}

#listmotcensure on
on *:text:*:#: { { set %comparmotcensure $1- | set %nbremotspam $numtok(%comparmotcensure,32)  | set %eventspam 0 | set %eventvulgaire 0 }
  while (%nbremotspam != 0) {
    /set %motcomparespam $gettok(%comparmotcensure,%nbremotspam,32)       
    if (((%cocher == s) || (%cocher == sv)) && (%motcomparespam == $read(listspam.txt,w, $+ %motcomparespam))) { inc %eventspam } 
    elseif (((%cocher == v) || (%cocher == sv)) && (%motcomparespam == $read(listvulgaire.txt,w, $+ %motcomparespam))) { inc %eventvulgaire }  
    if ((www isin $1-) && ((%cocher == s) || (%cocher == sv)) && (www isin $read(listspam.txt,w,*www*))) { inc %eventspam | set %motcomparespam www }
    if ((http isin $1-) && ((%cocher == s) || (%cocher == sv)) && (http isin $read(listspam.txt,w,*http*))) { inc %eventspam | set %motcomparespam http }
    if ((# isin $1-) && ((%cocher == s) || (%cocher == sv)) && (# isin $read(listspam.txt,w,*#*))) { inc %eventspam | set %motcomparespam # }
    if ((%eventvulgaire == 1) && (($me isop #) || ($me ishop #))) { /set %chan $chan | /set %censure %motcomparespam | /set %nick $nick | //echo -a 12 %meprevenir , 4C'est $nick sur # , il a dis %motcomparespam . Tu as 13 %dureaction 4secondes pour : prévenir $nick avec 13F1, 4 l'avertir d'un kick imminent (par ex s'il récidive) avec 13F2, 4le kicker avec 13F3, 4l'avertir d'un ban imminent avec 13F4 4et le bannir avec 13F5 | /enable #fkeycensure | /timerfkeycensure 1 %dureaction /disable #fkeycensure }
    if ((%eventspam == 1) && (($me isop #) || ($me ishop #))) { /set %chan $chan | /set %censure %motcomparespam | /set %nick $nick | //echo -a 12 %meprevenir , 4C'est $nick sur # , il a dis %motcomparespam . Tu as 13 %dureaction 4secondes pour : prévenir $nick avec 13F1, 4 l'avertir d'un kick imminent (par ex s'il récidive) avec 13F2, 4le kicker avec 13F3, 4l'avertir d'un ban imminent avec 13F4 4et le bannir avec 13F5  | /enable #fkeycensure | /timerfkeycensure 1 %dureaction /disable #fkeycensure }
    dec %nbremotspam 
  }

}
#listmotcensure end

#fkeycensure off

alias /F1 { //notice %nick %avertirmotcensure . tu as dis 4 %censure | .disable #fkeycensure | .timerfkeycensure off }
alias /F2 { //notice %nick %avertirkick . tu as dis 4 %censure | .disable #fkeycensure | .timerfkeycensure off }
alias /F3 { //kick %chan %nick %raisonkick . tu as dis 4 %censure | .disable #fkeycensure | .timerfkeycensure off } 
alias /F4 { //notice %nick %avertirban . tu as dis 4 %censure | .disable #fkeycensure | .timerfkeycensure off }
alias /F5 { //ban %chan %nick %raisonban . tu as dis 4 %censure | .disable #fkeycensure | .timerfkeycensure off }

#fkeycensure end

;----> à mettre dans la partie popup :

-
menu-detecteur de spam:.dialog -m ecranprincipal ecranprincipal
-

Conclusion :


Ben, à ma connaissance, jcrois pas qu'il y a des bugs, mais au cas où vous en trouveriez, faîtes le moi savoir :) merci.
chao all !!

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.