Code jeu ni oui ni non
#1
Bonjour,
J'ai trouvé un code tcl qui fonctionne tres bien mais pas toute a fait comme je veut j'ai beau cherché comment créer des regexp et le mettre en place mais je trouve pas donc pas facile pour un débutent :)

Le script fonctionne bien mais par exemple si une personne dit ouistiti sa le kick :/

j'ai créer un code en mirc le gros souci c'est qu'il faut resté connecter


Donc avez vous un code léger et mieux que sa svp merci ?

Code :
# Badword Kick by KuNgFo0

set badwords {
"oui"
"non"
"o u i"
"n o n"
}
# Kick MSG
set badword_msg "Bad Words"

# Channels
set badword_chans "#test #test1"

bind pubm - * pubm_badword

putlog "Badword loaded"

proc pubm_badword {nick uhost hand chan arg} {
        global badwords badword_msg badword_chans botnick
        if {(([lsearch -exact [string tolower $badword_chans] [string tolower $chan]] != -1) || ($badword_chans == "*")) && (![matchattr $hand b]) && ($nick != $botnick)} {
                foreach badword [string tolower $badwords] {
                        if {[string match *$badword* [string tolower $arg]]} {
                                putserv "KICK $chan $nick :$badword_msg"
                                return
                        }
                }
        }
}


Cordialement Stéphane
Répondre Avertir
#2
ta essayé en changeant
tcl
if {[string match *$badword* [string tolower $arg]]} {


par

tcl
if {[string match -nocase "*$badword*" $arg]} {



ton script fonctionne que si une personne dit "oui" ou "non" il doit être kicker ?

j'ai tester le code,il kick bien si une personne écris "oui" ou bien "non" est si une personne écris "ouistiti" le bot ne la pas kické.

tcl
proc pubm_badword {nick uhost hand chan arg} {
        global badwords badword_msg badword_chans botnick
        if {(([lsearch -exact [string tolower $badword_chans] [string tolower $chan]] != -1) || ($badword_chans == "*")) && (![matchattr $hand b]) && ($nick != $botnick)} {
                foreach badword [string tolower $badwords] {
                        if {[string match -nocase $badword $arg]} {
                                putserv "KICK $chan $nick :$badword_msg"
                                return
                        }
                }
        }
}





Cordialement DnS
Répondre Avertir
#3
Bonjour Fedora,
merci de ta réponse rapide :)
Pour répondre a ta question voila tu a bien compris le principe si la personne dit oui, non ou ouiiiiii ou noooooon etc.. la personne drva être kick du salon :)

fedora a écrit :ton script fonctionne que si une personne dit "oui" ou "non" il doit être kicker ?

J'ai testé ton morceau de code ci-dessous cher moi plus rien ne fonctionne il ne kick plus quand une personne dit oui ou non :/

fedora a écrit :ta essayé en changeant
tcl
if {[string match *$badword* [string tolower $arg]]} {


par

tcl
if {[string match -nocase "*$badword*" $arg]} {



ton script fonctionne que si une personne dit "oui" ou "non" il doit être kicker ?

j'ai tester le code,il kick bien si une personne écris "oui" ou bien "non" est si une personne écris "ouistiti" le bot ne la pas kické.

tcl
proc pubm_badword {nick uhost hand chan arg} {
        global badwords badword_msg badword_chans botnick
        if {(([lsearch -exact [string tolower $badword_chans] [string tolower $chan]] != -1) || ($badword_chans == "*")) && (![matchattr $hand b]) && ($nick != $botnick)} {
                foreach badword [string tolower $badwords] {
                        if {[string match -nocase $badword $arg]} {
                                putserv "KICK $chan $nick :$badword_msg"
                                return
                        }
                }
        }
}



Cordialement DnS

Cordialement Stéphane,
Répondre Avertir
#4
bah écoute j'vient de retesté encore le code:

Code :
|20:13:05|News:oui
|20:13:06| ·KICK· News|PG098FQuebec@1425230401454.tv|a été éjecté par bOt (Bad Words)

tcl
# Badword Kick by KuNgFo0
 
set badwords {
"oui"
"non"
}
# Kick MSG
set badword_msg "Bad Words"

# Channels
set badword_chans "#concept"
 
bind pubm - * pubm_badword
 
putlog "Badword loaded"
 
proc pubm_badword {nick uhost hand chan arg} {
        global badwords badword_msg badword_chans botnick
        if {(([lsearch -exact [string tolower $badword_chans] [string tolower $chan]] != -1) || ($badword_chans == "*")) && (![matchattr $hand b]) && ($nick != $botnick)} {
                foreach badword [string tolower $badwords] {
                        if {[string match -nocase $badword $arg]} {
                                putserv "KICK $chan $nick :$badword_msg"
                                return
                        }
                }
        }
}


Répondre Avertir
#5
Salut,

Moi j'ai essayer en fesant :

tcl
# Badword Kick by KuNgFo0
 
set badwords {
"*oui*"
"*non*"
}
# Kick MSG
set badword_msg "Bad Words"
 
# Channels
set badword_chans "#concept"
 
bind pubm - * pubm_badword
 
putlog "Badword loaded"
 
proc pubm_badword {nick uhost hand chan arg} {
        global badwords badword_msg badword_chans botnick
        if {(([lsearch -exact [string tolower $badword_chans] [string tolower $chan]] != -1) || ($badword_chans == "*")) && (![matchattr $hand b]) && ($nick != $botnick)} {
                foreach badword [string tolower $badwords] {
                        if {[string match -nocase $badword $arg]} {
                                putserv "KICK $chan $nick :$badword_msg"
                                return
                        }
                }
        }
}



en rajoutant des * au niveau de oui/non et sa fonctionne très bien.
Répondre Avertir
#6
Rheuuu !!!
Bon alors avec couleur ou un espace etc.... sa marche pas :s
et avec le code originale il prend les codes couleur etc... mais pas avec ton code :)

Citation :[20:29] <12snip74>  oui <--- marche pas
[20:29] <12snip74>  non <--- marche pas
[20:29] <12AzZaRo> snip74 sa marche pas 7¿08?09¿12?11¿13?04¿.
[20:29] <12snip74>  AzZaRo mais sa veut plus kick :s
[20:29] <12AzZaRo> ha
[20:29] <12snip74>  oui <--- marche pas
[20:29] <12AzZaRo> pourquoi
[20:30] <12snip74>  eerf oui zefz <--- marche pas
[20:30] <12snip74>  bah je ne c'est pas :D
[20:30] <12AzZaRo> lol
[20:30] <12AzZaRo> oui
[20:30] * AzZaRo was kicked by Nioui-Ninon (Bad Words)
[20:30] * AzZaRo has joined #Nioui-Ninon
[20:30] <12AzZaRo> non
[20:30] * AzZaRo was kicked by Nioui-Ninon (Bad Words)
[20:30] * AzZaRo has joined #Nioui-Ninon
AzZaRo a été vu avec les pseudos AzZaRo adidas lalalala
[20:30] <12AzZaRo> Nioui-Ninon Tu PrenDs ton PieD là 7¿08?09¿12?11¿13?04¿
[20:30] <12snip74>  o_O
[20:30] <12snip74>  non <--- marche pas
[20:30] <12AzZaRo> ben si sa marche
[20:30] <12AzZaRo> snip74 ben ta vu il ma éjècté
[20:30] <12snip74>  AzZaRo fait une phrase et mais oui
[20:30] <12snip74>  dedans :D
[20:31] <12AzZaRo> snip74 si je te dit que tu es un enfoire tu va me dire oui gen suis un :D
[20:31] <12snip74>  Lol Mdr
[20:31] <12AzZaRo> oui
[20:31] * AzZaRo was kicked by Nioui-Ninon (Bad Words)
[20:31] * AzZaRo has joined #Nioui-Ninon
AzZaRo a été vu avec les pseudos AzZaRo adidas lalalala
[20:31] <12AzZaRo> Nioui-Ninon Tu PrenDs ton PieD là 7¿08?09¿12?11¿13?04¿
[20:31] <12AzZaRo> c koi ce truc la
[20:32] <12AzZaRo> je comprend plus rien :D

Comme tu peut le voir sur se log avec les couleur sa marche plus et dans une phrase non plus :/

Cordialement Stéphane
Répondre Avertir
#7
j'écris en couleurs voici ce que sa donne :

Citation :[20:44:45] 14( 22@4seth 14) 05ça marche pas oui
[20:44:47] 44[Kick]14 seth 4par 6 Identifia  ( Bad Words14 1)
[20:44:57] 14( 22@4seth 14) 05ah bas si ça marche non ?
[20:44:57] 44[Kick]14 seth 4par 6 Identifia  ( Bad Words14 1)

donc comme tu peux le voir avec mes couleurs en testant ceci fonctionne. sinon tu peux rajouter un stripcodes à ta proc peut-être que ton soucis viens de la.
Répondre Avertir
#8
tcl
# Badword Kick by KuNgFo0
 
set badwords {
"*oui*"
"*non*"
}
# Kick MSG
set badword_msg "Bad Words"
 
# Channels
set badword_chans "#concept"
 
bind pubm - * pubm_badword
 
putlog "Badword loaded"
 
proc pubm_badword {nick uhost hand chan arg} {
        global badwords badword_msg badword_chans botnick
		set arg [stripcodes uacgbr $arg]
        if {(([lsearch -exact [string tolower $badword_chans] [string tolower $chan]] != -1) || ($badword_chans == "*")) && (![matchattr $hand b]) && ($nick != $botnick)} {
                foreach badword [string tolower $badwords] {
                        if {[string match -nocase $badword $arg]} {
                                putserv "KICK $chan $nick :$badword_msg"
                                return
                        }
                }
        }
}



j'ai ajouter
tcl
set arg [stripcodes uacgbr $arg]



ps: tester avec un applet java est sa fonctionne :] && oublie pas de restart ton bot.

Cordialement DnS
Répondre Avertir
#9
Bonsoir alias_angelius,
Trop bizarre chez vous sa fonctionne mais pas chez moi :/
alors que mon egg et tout neuf ^^

Cordialement Stéphane

alias_angelius a écrit :j'écris en couleurs voici ce que sa donne :

Citation :[20:44:45] 14( 22@4seth 14) 05ça marche pas oui
[20:44:47] 44[Kick]14 seth 4par 6 Identifia  ( Bad Words14 1)
[20:44:57] 14( 22@4seth 14) 05ah bas si ça marche non ?
[20:44:57] 44[Kick]14 seth 4par 6 Identifia  ( Bad Words14 1)

donc comme tu peux le voir avec mes couleurs en testant ceci fonctionne. sinon tu peux rajouter un stripcodes à ta proc peut-être que ton soucis viens de la.
Répondre Avertir
#10
fedora,

plutot :
tcl
set arg [stripcodes uacgbr [lindex $arg 0]]


non ?
Répondre Avertir
#11
snip74

comme la dit fedora restart ton bot et retente avec les modification :)
Répondre Avertir
#12
alias_angelius non j'ai pas eu besoin de lindex
j'm'en sert pour mon bot radio pour les users sous java
essaye :)
Répondre Avertir
#13
oui en effet sans le lindex ça fonctionne parfaitement.

autant pour moi :)
Répondre Avertir
#14
Rheuu !!! alias_angelius,
Oui je rehash et restart a chaque fois un habitude :)

Bon alors sa fonctionne avec le nouveau code de fedora ;) super merci :)
Citation :[20:52] * Snip74 sets mode: +q Nioui-Ninon
[20:52] <Snip74> non
[20:52] * You were kicked by Nioui-Ninon (Bad Words)
[20:52] * Attempting to rejoin channel #Nioui-Ninon
[20:52] * Rejoined channel #Nioui-Ninon
[20:52] * Topic is '~[]~ =>Salon ou il est interdit de dire oui et non sous peine de kick :p<= ~[]~'
[20:52] * Set by nani on Sun Aug 01 22:49:38
[20:52] <Snip74> AzZaRo fait une phrase et mais oui
[20:52] * You were kicked by Nioui-Ninon (Bad Words)
[20:52] * Attempting to rejoin channel #Nioui-Ninon
[20:52] * Rejoined channel #Nioui-Ninon
[20:52] * Topic is '~[]~ =>Salon ou il est interdit de dire oui et non sous peine de kick :p<= ~[]~'

Par contre voila encore un souci se que je vous disé au début quand une personne dit ex "ouistiti" sa ne devrait pas le kick :

Citation :[20:55] <AzZaRo> pour les couleur du salon sa veux dire oui alors
[20:55] * AzZaRo was kicked by Nioui-Ninon (Bad Words)
[20:55] * AzZaRo has joined #Nioui-Ninon
[20:55] <AzZaRo> Nioui-Ninon Tu PrenDs ton PieD là ¿?¿?¿?¿
[20:55] * AzZaRo was kicked by Nioui-Ninon (Bad Words)
[20:55] * AzZaRo has joined #Nioui-Ninon
[20:55] <AzZaRo> Nioui-Ninon Tu PrenDs ton PieD là ¿?¿?¿?¿
[20:55] * AzZaRo was kicked by Nioui-Ninon (Bad Words)
[20:55] * AzZaRo has joined #Nioui-Ninon
[20:55] <snip74> Mdr

Voila sa kick car il a un auto message lol et sa peut duré longtemps donc il a couper le salon

Cordialement Stéphane

[20:52] * Snip74 sets mode: +q Nioui-Ninon
[20:52] <Snip74> non
[20:52] * You were kicked by Nioui-Ninon (Bad Words)
[20:52] * Attempting to rejoin channel #Nioui-Ninon
[20:52] * Rejoined channel #Nioui-Ninon
[20:52] * Topic is '~[]~ =>Salon ou il est interdit de dire oui et non sous peine de kick :p<= ~[]~'
[20:52] * Set by nani on Sun Aug 01 22:49:38
[20:52] <Snip74> AzZaRo fait une phrase et mais oui
[20:52] * You were kicked by Nioui-Ninon (Bad Words)
[20:52] * Attempting to rejoin channel #Nioui-Ninon
[20:52] * Rejoined channel #Nioui-Ninon
[20:52] * Topic is '~[]~ =>Salon ou il est interdit de dire oui et non sous peine de kick :p<= ~[]~'

alias_angelius a écrit :snip74

comme la dit fedora restart ton bot et retente avec les modification :)
Répondre Avertir
#15
dans ce cas là faut faire une exception pour proteger ton bot
Répondre Avertir


Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté