mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
addquote now returns the number id of the quote that was added, i.e. Quote #4 added
This commit is contained in:
parent
0aa448bfc7
commit
91274d3f54
@ -84,11 +84,18 @@ class Quotes(ChannelDBHandler, callbacks.Privmsg):
|
|||||||
quote = privmsgs.getArgs(args)
|
quote = privmsgs.getArgs(args)
|
||||||
db = self.getDb(channel)
|
db = self.getDb(channel)
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
|
quotetime = int(time.time())
|
||||||
cursor.execute("""INSERT INTO quotes
|
cursor.execute("""INSERT INTO quotes
|
||||||
VALUES(NULL, %s, %s, %s)""",
|
VALUES(NULL, %s, %s, %s)""",
|
||||||
msg.nick, int(time.time()), quote)
|
msg.nick, quotetime, quote)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
criteria = ['added_by=%s' % msg.nick]
|
||||||
|
criteria.append('added_at=%s' % quotetime)
|
||||||
|
criteria.append('quote=%s' % quote)
|
||||||
|
sql = """SELECT id FROM quotes WHERE %s""" % ' AND '.join(criteria)
|
||||||
|
cursor.execute(sql)
|
||||||
|
quoteid = cursor.fetchone()[0]
|
||||||
|
irc.reply(msg, '%s (Quote #%s added)' % (conf.replySuccess, quoteid))
|
||||||
|
|
||||||
def numquotes(self, irc, msg, args):
|
def numquotes(self, irc, msg, args):
|
||||||
"""[<channel>]
|
"""[<channel>]
|
||||||
|
Loading…
Reference in New Issue
Block a user