recherche d'eggdrop
#46
Bonsoir djkenny,
merci encore de ton aide Smile
Effectivement je suis entrain de testé sur un plus gros salon et y a pas se souci Smile

j'ai mis plus de minute et sur plusieurs phrase Smile et donc c'est niquel Smile
Citation :variable time 15
variable lignes 20

djkenny a écrit :
Citation :Donc plus aucun souci mis a par si tu veut améliorer pour toi ou un autre ou même pour moi sans abusé de ta sympathie quand la personne se fait devoicé et se re mais a parler de suite après le devoice sa le re voice directe.

Regarde bien les secondes dans mon exemple pour comprendre Smile
en fait c est normal, le temps de mise a zéro du nombre de lignes est de 5 minutes donc forcement si tu mets une minutes pour le dévoice ça ne peut pas fonctionner correctement

Cordialement Stephane
hésitez pas de visité http://www.tchat-fusion.org/
ou part irc /server -m irc.tchat-fusion.org
Répondre Avertir
#47
Bonjour,
J'essaie de le mettre sur plusieurs salon comme sa mais sa veut pas Smile

Citation :variable salon #accueil,#salon
variable salon #accueil, #salon
variable salon #accueil #salon

qui a une solution svp merci ? :$

avec se code sa ma carrément couper l'eggdrop :

Citation :variable salon ""#accueil" "#salon""


Cordialement Stéphane
hésitez pas de visité http://www.tchat-fusion.org/
ou part irc /server -m irc.tchat-fusion.org
Répondre Avertir
#48
pour ajouté plusieurs salon il me semble c'est :

TCL
variable salon "#accueil" #salon2 #salon3"



Cordialement
La différence entre Linux et Windows ,c'est que Linux c'est comme une belle fille , il faut l'apprivoiser , la comprendre , la séduire tandis que Windows , c'est comme une prostitué , il faut payer et surtout bien se protéger.
Répondre Avertir
#49
salut,

le tcl est conçut pour fonctionner avec un seul salon, pour le faire fonctionner sur plusieurs salons il y a quelques modifications a effectuer
C'est en reconnaissant ses erreurs que l'on progresse Wink
Répondre Avertir
#50
TCL
namespace eval ::av {
   variable salons "#salon1 #salon2 #salon3"
   variable time 15
   variable lignes 5
 
 
   bind time - "* * * * *" av::Vvoice
   proc Vvoice {1 2 3 4 5} {
      variable idle
      variable salons
      variable time
      foreach salon [string tolower $salons] {
         if ![validchan $salon] continue
         foreach nick [chanlist $salon] {
            if {[isbotnick $nick] || [isop $nick $salon]} continue
            if {[info exists idle($salon)] && [dict exists $idle($salon) $nick]} {
               set n [dict get $idle($salon) $nick]
               set t1 [lindex $n 1]
               set t [expr [unixtime]-$t1]
               if {$t>[expr $time*60] && [isvoice $nick $salon]} {
                  pushmode $salon -v $nick
               }
               if {$t>300} {
                  dict set idle($salon) $nick [list 0 [unixtime]]
               }
            } else {
               dict set idle($salon) $nick [list 0 [unixtime]]
            }
         }
         flushmode $salon
      }
   }
 
   bind pubm - * av::Pvoice
 
   proc Pvoice {nick host hand chan arg} {
      variable lignes
      variable salons
      variable idle
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         set n [dict get $idle($chan) $nick]
         set i [lindex $n 0]
         dict set idle($chan) $nick [list [incr i] [unixtime]]
         if {$i>=$lignes} {pushmode $chan +v $nick}
      } else {
         dict set idle($chan) $nick [list 1 [unixtime]]
      }
   }
 
   bind join - * av::joinC
 
   proc joinC {nick host hand chan} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      dict set idle($chan) $nick [list 0 [unixtime]]
   }
 
   bind nick - * av::chgn
 
   proc chgn {nick host hand chan new} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         dict set idle($chan) $new [dict get $idle($chan) $nick]
         dict unset idle($chan) $nick
      } else {
         dict set idle($chan) $new [list 0 [unixtime]]
      }
   }
 
}


C'est en reconnaissant ses erreurs que l'on progresse Wink
Répondre Avertir
#51
mais.. pourquoi ouvrir le tcl pour rajouter un salon ?
sa serait pas mieu d'utilisé le setudef flag ?
Avec deux bind pub pour ajouté/retiré un salon non ?
Répondre Avertir
#52
parce-que je l'ai codé sur tcl-bot et que je n'ai pas encore ajouté le setudef.
de toute manière ce n'est pas le genre de commande que tu modifies tous les jours donc bon j'vois pas l’intérêt de polluer ton fichier chan pour pas grand chose
C'est en reconnaissant ses erreurs que l'on progresse Wink
Répondre Avertir
#53
C'est marrant comme vous faites ça, moi j'aurais cherché plus simple:

TCL
namespace eval av {
   variable salons "#salon1 #salon2 #salon3"
   variable time 15
   variable lignes 5
   variable idle
 
   bind time - "* * * * *" av::unvoice
   bind pubm - * av::voice
   bind nick - * av::chgn
 
   proc unvoice {min hour day month year} {
      foreach chan [string tolower $::av::salons] {
         if {![validchan $chan]} continue
         foreach nick [chanlist $chan] {
            if {[isbotnick $nick] || [isop $nick $chan] || ![isvoice $nick $chan]} continue
            if {[getchanidle $nick $chan] >= $time} {
               dict set ::av::idle($chan) $nick 0
               pushmode $chan -v $nick
            }
         }
         flushmode $chan
      }
   }
 
   proc voice {nick uhost handle chan args} {
      set chan [string tolower $chan]
      if {[lsearch -nocase $::av::salons $chan]==-1 || [isbotnick $nick] || [isop $nick $chan]} return
      if {[info exists ::av::idle($chan)] && [dict exists $::av::idle($chan) $nick]} {
         set i [dict get $::av::idle($chan) $nick]
         dict set ::av::idle($chan) $nick [incr i]
         if {$i>=$lignes} {pushmode $chan +v $nick}
      } else {
         dict set ::av::idle($chan) $nick 1
      }
      flushmode $chan
   }
 
   proc chgn {nick host hand chan new} {
      set chan [string tolower $chan]
      if {[lsearch -nocase $::av::salons $chan]==-1 || [isbotnick $nick]} return
      if {[info exists ::av::idle($chan)] && [dict exists $::av::idle($chan) $nick]} {
         dict set ::av::idle($chan) $new [dict get $::av::idle($chan) $nick]
         dict unset ::av::idle($chan) $nick
      } else {
         dict set ::av::idle($chan) $nick 0
      }
   }
}


Répondre
#54
djkenny a écrit :
alias_angelius a écrit :j'aurais plus utilisé getchanidle pour utilisé ce genre de système moi perso.
Et lors de cette utilisation tu évite d'utilisé un bind join

en fait non car le getchanidle prend en compte la moindre action qui est effectué même le changement de pseudo, j'ai testé comme ça mais ça fonctionnait vraiment très mal
@DnS: merci pour la correction, erreur d'inattention

à l'époque ou j ai codé ce tcl j'avais pensé à getchanidle mais comme je l'ai déjà dit ça ne fonctionnait pas bien
sans compter que appeler un variable par son namespace complet (::av::idle($chan)) est plus long que de la charger puis de l appeler simplement
Code :
% namespace eval truc { time {set test} 1000 }
0.795 microseconds per iteration
% namespace eval truc { time {set ::truc::test} 1000 }
1.207 microseconds per iteration
C'est en reconnaissant ses erreurs que l'on progresse Wink
Répondre Avertir
#55
Bonjour djkenny, CrazyCat,
Merci beaucoup de ton aide Smile

Avec le nouveau code que tu ma fourni j'ai cette erreur Smile

Citation :[10:19] missing close-brace
while executing
"namespace eval ::av {
variable salons "#Fusion #test"
variable time 10
variable lignes 2


bind time - "* * * * *" av::Vvoice
proc Vv..."
(file "scripts/idle.tcl" line 1)
invoked from within
"source scripts/idle.tcl"
(file "Eggdrop.conf" line 116)

djkenny a écrit :
TCL
namespace eval ::av {
   variable salons "#salon1 #salon2 #salon3"
   variable time 15
   variable lignes 5
 
 
   bind time - "* * * * *" av::Vvoice
   proc Vvoice {1 2 3 4 5} {
      variable idle
      variable salons
      variable time
      foreach salon [string tolower $salons] {
         if ![validchan $salon] continue
         foreach nick [chanlist $salon] {
            if {[isbotnick $nick] || [isop $nick $salon]} continue
            if {[info exists idle($salon)] && [dict exists $idle($salon) $nick]} {
               set n [dict get $idle($salon) $nick]
               set t1 [lindex $n 1]
               set t [expr [unixtime]-$t1]
               if {$t>[expr $time*60] && [isvoice $nick $salon]} {
                  pushmode $salon -v $nick
               }
               if {$t>300} {
                  dict set idle($salon) $nick [list 0 [unixtime]]
               }
            } else {
               dict set idle($salon) $nick [list 0 [unixtime]]
            }
         }
         flushmode $salon
      }
   }
 
   bind pubm - * av::Pvoice
 
   proc Pvoice {nick host hand chan arg} {
      variable lignes
      variable salons
      variable idle
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         set n [dict get $idle($chan) $nick]
         set i [lindex $n 0]
         dict set idle($chan) $nick [list [incr i] [unixtime]]
         if {$i>=$lignes} {pushmode $chan +v $nick}
      } else {
         dict set idle($chan) $nick [list 0 [unixtime]]
      }
   }
 
   bind join - * av::joinC
 
   proc joinC {nick host hand chan} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      dict set idle($chan) $nick [list 0 [unixtime]]
   }
 
   bind nick - * av::chgn
 
   proc chgn {nick host hand chan new} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         dict set idle($chan) $new [dict get $idle($chan) $nick]
         dict unset idle($chan) $nick
      } else {
         dict set idle($chan) $nick [list 0 [unixtime]]
      }
   }
 
}


J'ai essayer avec celui de CrazyCat aucun souci pour joindre les salons mais il fonctionne pas :$ et aucune ligne d'erreur Smile

CrazyCat a écrit :C'est marrant comme vous faites ça, moi j'aurais cherché plus simple:

TCL
namespace eval av {
   variable salons "#salon1 #salon2 #salon3"
   variable time 15
   variable lignes 5
   variable idle
 
   bind time - "* * * * *" av::unvoice
   bind pubm - * av::voice
   bind nick - * av::chgn
 
   proc unvoice {min hour day month year} {
      foreach chan [string tolower $::av::salons] {
         if {![validchan $chan]} continue
         foreach nick [chanlist $chan] {
            if {[isbotnick $nick] || [isop $nick $chan] || ![isvoice $nick $chan]} continue
            if {[getchanidle $nick $chan] >= $time} {
               dict set ::av::idle($chan) $nick 0
               pushmode $chan -v $nick
            }
         }
         flushmode $chan
      }
   }
 
   proc voice {nick uhost handle chan args} {
      set chan [string tolower $chan]
      if {[lsearch -nocase $::av::salons $chan]==-1 || [isbotnick $nick] || [isop $nick $chan]} return
      if {[info exists ::av::idle($chan)] && [dict exists $::av::idle($chan) $nick]} {
         set i [dict get $::av::idle($chan) $nick]
         dict set ::av::idle($chan) $nick [incr i]
         if {$i>=$lignes} {pushmode $chan +v $nick}
      } else {
         dict set ::av::idle($chan) $nick 1
      }
      flushmode $chan
   }
 
   proc chgn {nick host hand chan new} {
      set chan [string tolower $chan]
      if {[lsearch -nocase $::av::salons $chan]==-1 || [isbotnick $nick]} return
      if {[info exists ::av::idle($chan)] && [dict exists $::av::idle($chan) $nick]} {
         dict set ::av::idle($chan) $new [dict get $::av::idle($chan) $nick]
         dict unset ::av::idle($chan) $nick
      } else {
         dict set ::av::idle($chan) $nick 0
      }
   }
}


Cordialement Stephane
hésitez pas de visité http://www.tchat-fusion.org/
ou part irc /server -m irc.tchat-fusion.org
Répondre Avertir
#56
Ok, j'avais zappé ton explication sur le getchanidle.
Et je note pour les performances des appels.
Répondre
#57
@snip74: es tu sure d'avoir bien copier/coller l'intégralité du code?
C'est en reconnaissant ses erreurs que l'on progresse Wink
Répondre Avertir
#58
Bonjour djkenny,
Merci de ton aide Smile

Je pense que oui mais me suis aperçus qu'il étais sur le bon salon teste :$ donc peut etre pour sa qu'il planté ?

Donc effectivement il fonctionne sur les deux salon Smile.
Mais il y a un petit truc qui ne va pas :

dans :
Code :
variable time 15
variable lignes 5


Il devrai se déclenché au boue de 5 phrases au pire a la 6eme bah la il se déclenche a la 11eme Smile alors que ma variable et a 5 Smile

Ici je te mais le code copier coller telle qu'il et dans mon fichier avec le changement de salon
Code :
namespace eval ::av {
   variable salons "#fusion #teste"
   variable time 15
   variable lignes 5


   bind time - "* * * * *" av::Vvoice
   proc Vvoice {1 2 3 4 5} {
      variable idle
      variable salons
      variable time
      foreach salon [string tolower $salons] {
         if ![validchan $salon] continue
         foreach nick [chanlist $salon] {
            if {[isbotnick $nick] || [isop $nick $salon]} continue
            if {[info exists idle($salon)] && [dict exists $idle($salon) $nick]} {
               set n [dict get $idle($salon) $nick]
               set t1 [lindex $n 1]
               set t [expr [unixtime]-$t1]
               if {$t>[expr $time*60] && [isvoice $nick $salon]} {
                  pushmode $salon -v $nick
               }
               if {$t>300} {
                  dict set idle($salon) $nick [list 0 [unixtime]]
               }
            } else {
               dict set idle($salon) $nick [list 0 [unixtime]]
            }
         }
         flushmode $salon
      }
   }

   bind pubm - * av::Pvoice

   proc Pvoice {nick host hand chan arg} {
      variable lignes
      variable salons
      variable idle
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         set n [dict get $idle($chan) $nick]
         set i [lindex $n 0]
         dict set idle($chan) $nick [list [incr i] [unixtime]]
         if {$i>=$lignes} {pushmode $chan +v $nick}
      } else {
         dict set idle($chan) $nick [list 1 [unixtime]]
      }
   }

   bind join - * av::joinC

   proc joinC {nick host hand chan} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      dict set idle($chan) $nick [list 0 [unixtime]]
   }

   bind nick - * av::chgn

   proc chgn {nick host hand chan new} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         dict set idle($chan) $new [dict get $idle($chan) $nick]
         dict unset idle($chan) $nick
      } else {
         dict set idle($chan) $nick [list 0 [unixtime]]
      }
   }

}

djkenny a écrit :@snip74: es tu sure d'avoir bien copier/coller l'intégralité du code?

Cordialement Stéphane
hésitez pas de visité http://www.tchat-fusion.org/
ou part irc /server -m irc.tchat-fusion.org
Répondre Avertir
#59
petites corrections
TCL
namespace eval ::av {
   variable salons "#salon1 #salon2 #salon3"
   variable time 15
   variable lignes 5
 
 
   bind time - "* * * * *" av::Vvoice
   proc Vvoice {1 2 3 4 5} {
      variable idle
      variable salons
      variable time
      foreach salon [string tolower $salons] {
         if ![validchan $salon] continue
         foreach nick [chanlist $salon] {
            if {[isbotnick $nick] || [isop $nick $salon]} continue
            if {[info exists idle($salon)] && [dict exists $idle($salon) $nick]} {
               set n [dict get $idle($salon) $nick]
               set t1 [lindex $n 1]
               set t [expr [unixtime]-$t1]
               if {$t>[expr $time*60] && [isvoice $nick $salon]} {
                  pushmode $salon -v $nick
               }
               if {$t>300} {
                  dict set idle($salon) $nick [list 0 $t1]
               }
            } else {
               dict set idle($salon) $nick [list 0 [unixtime]]
            }
         }
         flushmode $salon
      }
   }
 
   bind pubm - * av::Pvoice
 
   proc Pvoice {nick host hand chan arg} {
      variable lignes
      variable salons
      variable idle
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         set n [dict get $idle($chan) $nick]
         set i [lindex $n 0]
         dict set idle($chan) $nick [list [incr i] [unixtime]]
         if {$i>=$lignes} {pushmode $chan +v $nick}
      } else {
         dict set idle($chan) $nick [list 1 [unixtime]]
      }
   }
 
   bind join - * av::joinC
 
   proc joinC {nick host hand chan} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      dict set idle($chan) $nick [list 0 [unixtime]]
   }
 
   bind nick - * av::chgn
 
   proc chgn {nick host hand chan new} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         dict set idle($chan) $new [dict get $idle($chan) $nick]
         dict unset idle($chan) $nick
      } else {
         dict set idle($chan) $new [list 0 [unixtime]]
      }
   }
}



Citation :Il devrai se déclenché au boue de 5 phrases au pire a la 6eme bah la il se déclenche a la 11eme Smile alors que ma variable et a 5 Smile
chez moi ça fonctionne parfaitement, essais de restart ton bot
C'est en reconnaissant ses erreurs que l'on progresse Wink
Répondre Avertir
#60
Bonjour djkenny,
Merci encore Wink
Avec se nouveau code je .rehash et .restart il ne fonctionne plus cher moi :/

djkenny a écrit :petites corrections
TCL
namespace eval ::av {
   variable salons "#salon1 #salon2 #salon3"
   variable time 15
   variable lignes 5
 
 
   bind time - "* * * * *" av::Vvoice
   proc Vvoice {1 2 3 4 5} {
      variable idle
      variable salons
      variable time
      foreach salon [string tolower $salons] {
         if ![validchan $salon] continue
         foreach nick [chanlist $salon] {
            if {[isbotnick $nick] || [isop $nick $salon]} continue
            if {[info exists idle($salon)] && [dict exists $idle($salon) $nick]} {
               set n [dict get $idle($salon) $nick]
               set t1 [lindex $n 1]
               set t [expr [unixtime]-$t1]
               if {$t>[expr $time*60] && [isvoice $nick $salon]} {
                  pushmode $salon -v $nick
               }
               if {$t>300} {
                  dict set idle($salon) $nick [list 0 $t1]
               }
            } else {
               dict set idle($salon) $nick [list 0 [unixtime]]
            }
         }
         flushmode $salon
      }
   }
 
   bind pubm - * av::Pvoice
 
   proc Pvoice {nick host hand chan arg} {
      variable lignes
      variable salons
      variable idle
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         set n [dict get $idle($chan) $nick]
         set i [lindex $n 0]
         dict set idle($chan) $nick [list [incr i] [unixtime]]
         if {$i>=$lignes} {pushmode $chan +v $nick}
      } else {
         dict set idle($chan) $nick [list 1 [unixtime]]
      }
   }
 
   bind join - * av::joinC
 
   proc joinC {nick host hand chan} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      dict set idle($chan) $nick [list 0 [unixtime]]
   }
 
   bind nick - * av::chgn
 
   proc chgn {nick host hand chan new} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         dict set idle($chan) $new [dict get $idle($chan) $nick]
         dict unset idle($chan) $nick
      } else {
         dict set idle($chan) $new [list 0 [unixtime]]
      }
   }
}



Citation :Il devrai se déclenché au boue de 5 phrases au pire a la 6eme bah la il se déclenche a la 11eme Smile alors que ma variable et a 5 Smile
chez moi ça fonctionne parfaitement, essais de restart ton bot

Cordialement Stéphane
hésitez pas de visité http://www.tchat-fusion.org/
ou part irc /server -m irc.tchat-fusion.org
Répondre Avertir


Atteindre :


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