fix remember, make tell use notices, remove re because of abuse
This commit is contained in:
parent
a21f27e64e
commit
04b1a718f1
|
@ -24,11 +24,15 @@ class Input(dict):
|
|||
|
||||
def pm(msg):
|
||||
conn.msg(nick, msg)
|
||||
|
||||
def notice(msg):
|
||||
conn.cmd('NOTICE', [nick, msg])
|
||||
|
||||
dict.__init__(self, conn=conn, raw=raw, prefix=prefix, command=command,
|
||||
params=params, nick=nick, user=user, host=host,
|
||||
paraml=paraml, msg=msg, server=conn.server, chan=chan,
|
||||
say=say, reply=reply, pm=pm, bot=bot, lastparam=paraml[-1])
|
||||
notice=notice, say=say, reply=reply, pm=pm, bot=bot,
|
||||
lastparam=paraml[-1])
|
||||
|
||||
# make dict keys accessible as attributes
|
||||
def __getattr__(self, key):
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
'''
|
||||
regular.py
|
||||
|
||||
skybot plugin for testing regular expressions
|
||||
by Ipsum
|
||||
'''
|
||||
|
||||
import re
|
||||
|
||||
from util import hook
|
||||
|
||||
|
||||
@hook.command('re')
|
||||
def reg(inp):
|
||||
".re <regex> <string> -- matches regular expression in given <string> "\
|
||||
"(leave 2 spaces between)"
|
||||
|
||||
query = inp.split(" ", 1)
|
||||
|
||||
if not inp or len(query) != 2:
|
||||
return reg.__doc__
|
||||
|
||||
return '|'.join(re.findall(query[0], query[1]))
|
|
@ -67,6 +67,6 @@ def question(inp, chan='', say=None, db=None):
|
|||
"?<word> -- shows what data is associated with word"
|
||||
db_init(db)
|
||||
|
||||
data = get_memory(db, chan, inp.group(1))
|
||||
data = get_memory(db, chan, inp.group(1).strip())
|
||||
if data:
|
||||
say(data)
|
||||
|
|
|
@ -44,11 +44,11 @@ def tellinput(paraml, input=None, db=None, bot=None):
|
|||
db.execute("delete from tell where user_to=lower(?) and message=?",
|
||||
(input.nick, message))
|
||||
db.commit()
|
||||
input.pm(reply)
|
||||
input.notice(reply)
|
||||
|
||||
|
||||
@hook.command
|
||||
def showtells(inp, nick='', chan='', pm=None, db=None):
|
||||
def showtells(inp, nick='', chan='', notice=None, db=None):
|
||||
".showtells -- view all pending tell messages (sent in PM)."
|
||||
|
||||
db_init(db)
|
||||
|
@ -56,13 +56,13 @@ def showtells(inp, nick='', chan='', pm=None, db=None):
|
|||
tells = get_tells(db, nick)
|
||||
|
||||
if not tells:
|
||||
pm("You have no pending tells.")
|
||||
notice("You have no pending tells.")
|
||||
return
|
||||
|
||||
for tell in tells:
|
||||
user_from, message, time, chan = tell
|
||||
reltime = timesince.timesince(time)
|
||||
pm("%s said %s ago in %s: %s" % (user_from, reltime, chan, message))
|
||||
notice("%s said %s ago in %s: %s" % (user_from, reltime, chan, message))
|
||||
|
||||
db.execute("delete from tell where user_to=lower(?)",
|
||||
(nick,))
|
||||
|
|
Loading…
Reference in New Issue