essaye ce TCL stp pour voir.aparament il changerais le topic tous les X minutes ça peut etre pas mal dans ce que tu voudrais.
par contre je te garantit pas qu'il n'y à pas des beug hein! je peut pas tester le TCL ,donc à toi de corriger si y en a, ou nous remontrer les erreurs.
cordialement
tcl
# tcl.randtopic
# based on tcl.topic by Brian_C
#
# 02-08-96 cmw!cmwagner@gate.net Added random_topic array, to allow random
# topics to be set every hour.
# 03-02-96 cmw!cmwagner@gate.net Added load/write/add/delete/show routines,
# to allow masters to remotely maintain the
# topics list
# 03-04-96 cmw!cmwagner@gate.net Added set command and added help command.
# 03-06-96 cmw!cmwagner@gate.net Added refresh command.
# topic file
# set topicfile "topics"
# topic refresh time, in minutes
set topic_refresh_rate 30
bind msg - topic msg_topic
proc set_topic {} {
global channel random_topic topics_changed topic_refresh_rate
if {$topics_changed == 1} {
putlog "Writing topics file..."
topic_write
}
set topic [lindex $random_topic [rand [llength $random_topic]]]
putserv "TOPIC $channel :$topic"
timer $topic_refresh_rate set_topic
}
proc sync_topic {} {
set time_ending [string range [time] 2 4]
if { $time_ending == ":00" } {
set_topic
} {
timer 1 sync_topic
}
}
proc topic_show {nick uhost hand arg} {
global channel random_topic botnick
putserv "NOTICE $nick :Topics for \002$channel\002:"
set ctr 0
foreach i $random_topic {
incr ctr 1
putserv "NOTICE $nick :\002${ctr}.\002 $i"
}
putserv "PRIVMSG $nick :---- \002end\002 ----"
if {$hand != "*" && [matchattr $hand m]} {
putserv "PRIVMSG $nick :To add a topic type \002/msg $botnick TOPIC HELP\002 for help."
}
return 1
}
proc topic_add {nick uhost hand arg} {
global channel random_topic topics_changed
if {![matchattr $hand m]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {[lindex $arg 1] == ""} {
putserv "PRIVMSG $nick :Usage: TOPIC ADD <new topic>"
return 0
}
putserv "PRIVMSG $nick :Topic list has been updated, thanks."
putserv "PRIVMSG $nick :[lrange $arg 1 end]"
lappend random_topic [lrange $arg 1 end]
set topics_changed 1
return 1
}
proc topic_erase {nick uhost hand arg} {
global random_topic topics_changed
if {![matchattr $hand m]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {[lindex $arg 1] == ""} {
putserv "PRIVMSG $nick :Usage: TOPIC DEL <topic#>"
return 0
}
set i [expr [lindex $arg 1] - 1]
if {$i >=0 && [lindex $random_topic $i] != ""} {
putserv "PRIVMSG $nick :Entry [lindex $arg 1] erased."
putserv "PRIVMSG $nick :[lindex $random_topic $i]"
set random_topic [lreplace $random_topic $i $i]
set topics_changed 1
return 1
} {
putserv "PRIVMSG $nick :That number is out of range!"
return 0
}
}
proc topic_set {nick uhost hand arg} {
global channel random_topic
if {![matchattr $hand m]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {[lindex $arg 1] == ""} {
putserv "PRIVMSG $nick :Usage: TOPIC SET <topic#>"
return 0
}
set i [expr [lindex $arg 1] - 1]
if {$i >=0 && [lindex $random_topic $i] != ""} {
putserv "PRIVMSG $nick :Setting current topic to entry [lindex $arg 1]."
putserv "TOPIC $channel :[lindex $random_topic $i]"
return 1
} {
putserv "PRIVMSG $nick :That number is out of range!"
return 0
}
}
proc topic_refresh {nick uhost hand arg} {
global topic_refresh_rate
if {![matchattr $hand m]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {[lindex $arg 1] == ""} {
putserv "PRIVMSG $nick :Usage: TOPIC REF <minutes>"
return 0
}
set i [lindex $arg 1]
if {$i < 30 || $i > 240} {
putserv "PRIVMSG $nick :Refresh rate must be 30 - 240 minutes."
return 0
} {
set topic_refresh_rate $i
putserv "PRIVMSG $nick :Refresh rate has been changed to \002$topic_refresh_rate\002 minutes, this change"
putserv "PRIVMSG $nick :will be effective after the next topic change."
return 1
}
}
proc topic_help {nick uhost hand arg} {
putserv "PRIVMSG $nick :Usage: TOPIC - show topics"
if {[matchattr $hand m]} {
putserv "PRIVMSG $nick : TOPIC ADD <new topic> - add topic entry"
putserv "PRIVMSG $nick : TOPIC DEL <topic#> - delete topic entry"
putserv "PRIVMSG $nick : TOPIC SET <topic#> - set current topic to topic#"
putserv "PRIVMSG $nick : TOPIC REF <minutes> - change topic refresh rate"
}
return 1
}
proc topic_load {} {
global random_topic topicfile
set random_topic ""
set fd [open $topicfile r]
while {![eof $fd]} {
set inp [gets $fd]
if {[eof $fd]} {break}
if {[string trim $inp " "] == ""} {continue}
lappend random_topic [lrange $inp 0 end]
}
close $fd
return 1
}
proc topic_write {} {
global topicfile random_topic topics_changed
set fd [open $topicfile w]
foreach i $random_topic {
puts $fd "$i"
}
close $fd
set topics_changed 0
return 1
}
proc msg_topic {nick uhost hand arg} {
switch [string tolower [lindex $arg 0]] {
"add" {set r [topic_add $nick $uhost $hand $arg]}
"del" {set r [topic_erase $nick $uhost $hand $arg]}
"delete" {set r [topic_erase $nick $uhost $hand $arg]}
"set" {set r [topic_set $nick $uhost $hand $arg]}
"ref" {set r [topic_refresh $nick $uhost $hand $arg]}
"refresh" {set r [topic_refresh $nick $uhost $hand $arg]}
"help" {set r [topic_help $nick $uhost $hand $arg]}
default {set r [topic_show $nick $uhost $hand $arg]}
}
return $r
}
if {![info exists set_topic_running] && ![info exists random_topic]} {
sync_topic
set set_topic_running 1
}
set topics_changed 0
topic_load
par contre je te garantit pas qu'il n'y à pas des beug hein! je peut pas tester le TCL ,donc à toi de corriger si y en a, ou nous remontrer les erreurs.
cordialement