I've a script that's able to fetch a quote from a MySQL database, with the command !quote.
But now I'd like to have something like !quoteoftheday, which returns a quote, which will return the same quote all this day long (selected randomly ofcourse).
I guess there are numeous ways of doing this.
The first that comes to mind for me though, would be to store a "quote id generation timestamp", and generate a new quote or "quote-id" if the timestamp is too old...
proc someproc {} {
set now [clock scan "today 00:00"]
if {![info exists ::QuoteTimestamp] || $::QuoteTimestamp <= $now} {
#Generate new quote here...
set ::QuoteTimestamp $now
}
#Send the quote to the channel
}