I run a convention site, with chat room and would like a way for the bot to change the topic to include the how many more days untill (this convention).
One of the things though is I need to be able to set multiple dates and multiple places. Because we work with other local conventions. So the topic would read:
"Topic: 340 more days till radcon!, 56 more days till norwescon! etc."
With perhaps certain things where you could say that when it was within a week he would say something different than just days. Like 2months and 3 days. or only one week away!
If this script is too complicated forgive me for asking I am new here and don't know what is considered an allowable request.
# set the name and date for the convention here
# convention name mm/dd/yy
set conventions {
"radcon 04/25/05"
"norwescon 07/11/2005"
"and another convention 08/15/2005"
}
# channel
set convchan #channel
bind pub -|- !topconv pubconv
bind time - "00 00 * * *" convtime
proc pubconv {nick uhost hand chan text} {
settopic
}
proc convtime {min hour day month year} {
settopic
}
proc settopic {} {
foreach c $::conventions {
set conv [lrange $c 0 end-1]
set when [clock scan [lindex $c end]]
set days [expr ($when-[clock seconds])/86400]
lappend topic "$days more days till [join $conv]!"
}
putserv "TOPIC $::convchan :[join $topic {, }]"
}
It will update the topic at midnight every night, and you can also type !topconv to update it.
I suppose this topic is from over a year ago, but it still fits very well what I need, but not quite.
My topic is in the format of "http://example.com | <countdown> | Any text"
I'd really appreciate it if someone could slightly modify the above script to put it into that format, and maybe reupdate the topic whenever anyone changes it in case the countdown gets taken out accidentally.
That's not very easy to do if your topic constantly changes, so I wouldn't count on it anytime soon (unless the countdown should always be in the middle of the | | part (in which case, it wouldn't be very hard at all)
metroid wrote:That's not very easy to do if your topic constantly changes, so I wouldn't count on it anytime soon (unless the countdown should always be in the middle of the | | part (in which case, it wouldn't be very hard at all)
The countdown would always be in the || part, and the URL never changes. If someone were to erase the countdown part, i'd want the bot to go about fixing it and putting it back.