Made quotes.randomquote simple dispatch to a quote with a --id option.

This commit is contained in:
Jeremy Fincher 2003-10-04 10:22:36 +00:00
parent 9543859047
commit 195dc208dd

View File

@ -204,14 +204,14 @@ class Quotes(ChannelDBHandler, callbacks.Privmsg):
channel = privmsgs.getChannel(msg, args) channel = privmsgs.getChannel(msg, args)
db = self.getDb(channel) db = self.getDb(channel)
cursor = db.cursor() cursor = db.cursor()
cursor.execute("""SELECT id, quote FROM quotes cursor.execute("""SELECT id FROM quotes
ORDER BY random() ORDER BY random()
LIMIT 1""") LIMIT 1""")
if cursor.rowcount != 1: if cursor.rowcount != 1:
irc.error(msg, 'It seems that quote database is empty.') irc.error(msg, 'It seems that quote database is empty.')
return return
(id, quote) = cursor.fetchone() (id,) = cursor.fetchone()
irc.reply(msg, '%s (#%s)' % (quote, id)) self.quote(irc, msg, [channel, '--id', str(id)])
def quoteinfo(self, irc, msg, args): def quoteinfo(self, irc, msg, args):
"""[<channel>] <id> """[<channel>] <id>