Moved munge to the text module, added steamcalc plugin with DB logging of values, added steamtop command to show top values.
This commit is contained in:
parent
25f9ecfa51
commit
b9dee4e802
4 changed files with 119 additions and 79 deletions
|
@ -5,18 +5,22 @@ import re
|
|||
|
||||
from util import hook, timesince
|
||||
|
||||
db_ready = False
|
||||
|
||||
|
||||
def db_init(db):
|
||||
"check to see that our db has the the seen table and return a connection."
|
||||
db.execute("create table if not exists seen_user(name, time, quote, chan, host, "
|
||||
"primary key(name, chan))")
|
||||
db.commit()
|
||||
db_ready = True
|
||||
|
||||
|
||||
@hook.singlethread
|
||||
@hook.event('PRIVMSG', ignorebots=False)
|
||||
def seen_sieve(paraml, input=None, db=None, bot=None):
|
||||
db_init(db)
|
||||
if not db_ready:
|
||||
db_init(db)
|
||||
# keep private messages private
|
||||
if input.chan[:1] == "#":
|
||||
db.execute("insert or replace into seen_user(name, time, quote, chan, host)"
|
||||
|
@ -38,7 +42,8 @@ def seen(inp, nick='', chan='', db=None, input=None):
|
|||
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
||||
return "I can't look up that name, its impossible to use!"
|
||||
|
||||
db_init(db)
|
||||
if not db_ready:
|
||||
db_init(db)
|
||||
|
||||
last_seen = db.execute("select name, time, quote from seen_user where name"
|
||||
" like ? and chan = ?", (inp, chan)).fetchone()
|
||||
|
|
Reference in a new issue