| View previous topic :: View next topic |
| Author |
Message |
traxx Voice
Joined: 03 Jan 2006 Posts: 11
|
Posted: Thu May 04, 2006 4:46 pm Post subject: Kind of Countdown |
|
|
Hi there,
could anyone please help me doing the following:
The bot should post a message every 3 hours. The content should be this:
"A new feature will be available by March 16 2006. Until then there are still X months, X days and X minutes."
It would be really great if somebody could help me.
Thanks in advance! |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu May 04, 2006 8:33 pm Post subject: |
|
|
| Code: | set reachdate mm/dd/yy
bind time - * postmsg
proc postmsg {m h args} {
global reachdate
if {!([scan $h %d]%3)} {
set date [clock scan $reachdate]
set fulldate [clock format $date -format "%B %d %Y"]
set dur [duration [expr {$date-[clock seconds]}]]
puthelp "privmsg #channel :A new feature will be available by $fulldate. Until then there are still $dur."
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
traxx Voice
Joined: 03 Jan 2006 Posts: 11
|
Posted: Fri May 05, 2006 7:54 am Post subject: |
|
|
thanks for your answer, but for some strange reason the bot doesn't do anything  |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
traxx Voice
Joined: 03 Jan 2006 Posts: 11
|
Posted: Fri May 05, 2006 11:20 am Post subject: |
|
|
yap, i did  |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri May 05, 2006 12:03 pm Post subject: |
|
|
| Code: | set reachdate mm/dd/yy
bind time - "00 *" postmsg
proc postmsg {m h args} {
global reachdate
if {[scan $h %d]%3 == 0} {
set date [clock scan $reachdate]
set fulldate [clock format $date -format "%B %d %Y"]
set dur [germanize [duration [expr {$date-[clock seconds]}]]]
puthelp "privmsg #channel :A new feature will be available by $fulldate. Until then there are still $dur."
}
}
proc germanize str {
regsub -nocase {week(s?)} $str "wochen" str
regsub -nocase {hour(s?)} $str "stunden" str
regsub -nocase {day(s?)} $str "tage" str
set str
} |
Edit: added translating weeks, hours, and days to german. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts
Last edited by Sir_Fz on Fri May 05, 2006 7:27 pm; edited 2 times in total |
|
| Back to top |
|
 |
traxx Voice
Joined: 03 Jan 2006 Posts: 11
|
Posted: Fri May 05, 2006 4:24 pm Post subject: |
|
|
Thanks, working perfectly, but...
I wonder if it's possible to replace "weeks", "hours" and "days" in the time expression by it's german equivalents "wochen", "stunden" and "tage".
It would be great if anyone was so kind to explain that to me.
Thanks a lot! |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
|