putserv "PRIVMSG $channel :\002There is \026NEW\026 $channel news since the last hour \([news_count] items\)! To display it, /msg $botnick NEWS READ\002"
putlog "NEWS: announced NEW news to channel"
} else {
putserv "PRIVMSG $channel :\002There is $channel news \([news_count] items\). To display it, /msg $botnick NEWS READ\002"
putlog "NEWS: announced news to channel"
}
} else {
putlog "NEWS: no news to announce"
return 0
}
set news_newnews 0
return 1
}
# Announce the news once an hour
proc news_timer {} { }
# Make sure it is announced on the hour, not at any random time
proc news_sync {} {
set time_ending [string range [time] 2 4]
if { $time_ending == ":00" } {
news_timer
} {
timer 1 news_sync
}
}
# Start the timer running if it's not already
# NB. This is NOT a procedure, it is global.
if {![info exists set_news_running]} {
news_sync
set set_news_running 1
}
# Add a news item
proc news_add {nick uhost hand arg} {
global newsfile botnick news_ncount news_newnews news_biggest_ts
if {![validuser $hand]} {
puthelp "NOTICE $nick :Please introduce yourself to me first with \002/msg $botnick hello\002"