From 04b1a718f17d764cecdc0345f7c15a5af7371301 Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Tue, 13 Apr 2010 15:39:40 -0600 Subject: [PATCH] fix remember, make tell use notices, remove re because of abuse --- core/main.py | 6 +++++- plugins/regular.py | 23 ----------------------- plugins/remember.py | 2 +- plugins/tell.py | 8 ++++---- 4 files changed, 10 insertions(+), 29 deletions(-) delete mode 100644 plugins/regular.py diff --git a/core/main.py b/core/main.py index 9de5139..e532333 100644 --- a/core/main.py +++ b/core/main.py @@ -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): diff --git a/plugins/regular.py b/plugins/regular.py deleted file mode 100644 index 511c350..0000000 --- a/plugins/regular.py +++ /dev/null @@ -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 -- matches regular expression in given "\ - "(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])) diff --git a/plugins/remember.py b/plugins/remember.py index 7ec8679..6a55249 100644 --- a/plugins/remember.py +++ b/plugins/remember.py @@ -67,6 +67,6 @@ def question(inp, chan='', say=None, db=None): "? -- 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) diff --git a/plugins/tell.py b/plugins/tell.py index 5d52ce8..996b5ed 100644 --- a/plugins/tell.py +++ b/plugins/tell.py @@ -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,))