egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Quote of the day

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Kaj
Voice


Joined: 22 Sep 2013
Posts: 3

PostPosted: Sun Sep 22, 2013 5:14 am    Post subject: Quote of the day Reply with quote

Hey everyone,

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).

So that it returns a different quote everyday.

How can I do this?

~Kaj
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Sep 22, 2013 10:14 am    Post subject: Reply with quote

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...

A simple example would look like this
Code:
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
}

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber