29/08/2009, 12:13
bonjour,
voici un TCL de quote assez simple (certes en anglais) mais qui je pense si tu ajoute un bind time pour qu'il récupère des quotes dans le quote.txt ça peut t'être pas mal.je suis sur tu peut faire quelque chose de bien :)
ceci et un TCL trouvé avec mon amis "Google" :)
cordialement
voici un TCL de quote assez simple (certes en anglais) mais qui je pense si tu ajoute un bind time pour qu'il récupère des quotes dans le quote.txt ça peut t'être pas mal.je suis sur tu peut faire quelque chose de bien :)
tcl
## Quote.tcl by N86ers ###
# A simple quote script with random output :)
# Set the trigger for quote adding:
set quotetrigger "!quote"
# Set the trigger for random output:
set randomtrigger "!rquote"
# Set trigger for deleting quotes:
set deltrigger "!delquote"
### Lame code begins :) ###
bind pub -* $quotetrigger quote
bind pub -* $randomtrigger rquote
bind pub -* $deltrigger delquote
proc quote {nick uhost hand chan arg} {
global quotetrigger
if {[llength $arg] == 0 } {
putquick "privmsg $chan :Use $quotetrigger <newquote>"
} else {
set data [open "./scripts/quote.txt" a]
puts $data "$nick $arg"
close $data
putquick "privmsg $chan :Added \037$arg\037 to the quote list :)"
return 1
}
}
proc delquote {nick uhost hand chan arg} {
if {![string length [string trim $arg]]} {
putquick "PRIVMSG $chan :Use $::deltrigger <quote>"
} else {
set fid [open "./scripts/quote.txt" r]
if {[set pos [lsearch -glob [set ldata [split [read -nonewline $fid] \n]] $arg]] != -1} {
# Close the read-only fileID:
close $fid
# Open the file again for writing:
set fid [open "./scripts/quote.txt" w]
puts $fid [join [lreplace $ldata $pos $pos] \n]
close $fid
putquick "PRIVMSG $chan :Deleted \037$arg\037 from the quote list =("
} else {
# Close the read-only fileID:
close $fid
putquick "PRIVMSG $chan :Can not find \037$arg\037 in the quotelist!"
}
}
}
proc rquote {nick uhost hand chan arg} {
set quotes ""
set data [open "./scripts/quote.txt" r]
while { ![eof $data] } {
set quote [gets $data]
if { $quote != "" } {
set quotes [linsert $quotes end $quote]
}
}
close $data
set random [rand [llength $quotes]]
if { [expr $random >= 0] && [expr $random < [llength $quotes]] } {
set quote [lindex $quotes $random]
set out1 [lrange [split $quote] 1 end]
set out [lindex $quote 0]
}
if { $quote != "" } {
putquick "privmsg $chan :Heres a quote: \037$out1\037 Added by \037$out\037"
}
}
putlog "Quote.tcl v.1.1 by N86ers is loaded!"
ceci et un TCL trouvé avec mon amis "Google" :)
cordialement