.tell: limit the .tell user to three tells per person at one time
This commit is contained in:
parent
df77f79242
commit
e268a06268
|
@ -56,11 +56,15 @@ def tell(bot, input):
|
||||||
if query[2] != "":
|
if query[2] != "":
|
||||||
dbpath = os.path.join(bot.persist_dir, dbname)
|
dbpath = os.path.join(bot.persist_dir, dbname)
|
||||||
conn = dbconnect(dbpath)
|
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."
|
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()
|
cursor = conn.cursor()
|
||||||
command = "insert into tell(name, user_from, quote, chan, date) values(?,?,?,?,?)"
|
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()))
|
cursor.execute(command, (query[0], input.nick, query[2], input.chan, datetime.datetime.now()))
|
||||||
|
|
Loading…
Reference in New Issue