Changed randomquote to give the number of the quote

This commit is contained in:
Jeremy Fincher 2003-03-25 23:26:31 +00:00
parent b38e5e2252
commit 273e426972
1 changed files with 3 additions and 3 deletions

View File

@ -140,14 +140,14 @@ class Quotes(DBHandler, 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 quote FROM quotes cursor.execute("""SELECT (id, quote) 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
quote = cursor.fetchone()[0] (id, quote) = cursor.fetchone()
irc.reply(msg, quote) irc.reply(msg, '%s [#%s]' % (quote, id))
return return
def quoteinfo(self, irc, msg, args): def quoteinfo(self, irc, msg, args):