From e268a06268395815529347b76195c63c628bd692 Mon Sep 17 00:00:00 2001 From: Chris Skalenda Date: Sun, 5 Jul 2009 10:40:04 -0500 Subject: [PATCH] .tell: limit the .tell user to three tells per person at one time --- plugins/tell.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/tell.py b/plugins/tell.py index 84a39b2..0e73fda 100644 --- a/plugins/tell.py +++ b/plugins/tell.py @@ -56,11 +56,15 @@ def tell(bot, input): if query[2] != "": dbpath = os.path.join(bot.persist_dir, dbname) conn = dbconnect(dbpath) - filterUser = conn.execute("select count(*) from tell_probation where name=?", (input.nick,)).fetchone() - if filterUser[0] > 0: + command = "select count(*) from tell_probation where name=?" + if conn.execute(command, (input.nick,)).fetchone()[0] > 0: return "No." + command = "select count(*) from tell where name=? and user_from=?" + if conn.execute(command, (query[0], input.nick)).fetchone()[0] >= 3: + return "You've told that person too many things." + cursor = conn.cursor() command = "insert into tell(name, user_from, quote, chan, date) values(?,?,?,?,?)" cursor.execute(command, (query[0], input.nick, query[2], input.chan, datetime.datetime.now()))