Quoteur
#7
Bon j'ai testé un petit code qui donc est censé quand quelqu'un tape !quote, ca enregistre les quotes dans un fichier nommé quote.txt
et le script quand il detecte le mot quote il devrais aller dans le fichier de stockae et sortir une quote au hasard.

Voici le tcl
tcl
#nom du fichier texte à lire 
set fname "scripts/quote.txt" 
 
bind pub - !quote pub:!quote 
proc pub:!quote { nick host hand chan text } { 
global fname 
set f [open "$fname" "a"] 
puts $f "Quote ajouté par $nick [clock format [clock seconds] -format {le %A %d %B %Y } ] ==> $text" 
close $f 
} 
 
 
 
proc fun:pub:quote {nick uhost hand channel arg} {
global fun quote botnick
if ![matchattr $nick $fun(ignflags) $channel] {
   if {[fun:flood $nick $uhost]} {
      return 0
   }
}
if {(([lsearch -exact [string tolower $quote(chans)] [string tolower $channel]] != -1) || ($quote(chans) == "*")) && (![matchattr $hand b]) && ($nick != $botnick)} {
   putserv "PRIVMSG $channel :[lindex $quote(msgs) [rand [llength $quote(msgs) ]]]"
   return 1
}
}
 
bind pubm -|- *quote* fun:pub:quote

# Channels où le bot répondra :
set quote(chans) "*"



Seulement j'ai un soucis ca enregistre bien les quotes dans le fichier voulu, mais quand il doit lire une quote au hasard j'ai cette erreure "Tcl error [fun:pub:quote]: can't read "fname": no such variable"
Répondre Avertir


Messages dans ce sujet
Quoteur - par loulou7593 - 04/06/2009, 21:47
RE: Quoteur - par MenzAgitat - 04/06/2009, 23:55
RE: Quoteur - par loulou7593 - 05/06/2009, 00:18
RE: Quoteur - par MenzAgitat - 05/06/2009, 12:57
RE: Quoteur - par loulou7593 - 05/06/2009, 17:50
RE: Quoteur - par MenzAgitat - 05/06/2009, 19:50
RE: Quoteur - par loulou7593 - 06/06/2009, 03:09
RE: Quoteur - par fedora - 06/06/2009, 10:02
RE: Quoteur - par loulou7593 - 06/06/2009, 16:11
RE: Quoteur - par loulou7593 - 06/06/2009, 17:22
RE: Quoteur - par loulou7593 - 06/06/2009, 19:07

Atteindre :


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