Added 'me' function for action strings.

Example:
def foo(input, me=None):
  me("is doing %s" % input)
This commit is contained in:
Nathan Manzi 2010-07-14 14:57:43 +08:00
parent b9f74dba71
commit 5bae80789f
1 changed files with 4 additions and 1 deletions

View File

@ -25,6 +25,9 @@ class Input(dict):
def pm(msg): def pm(msg):
conn.msg(nick, msg) conn.msg(nick, msg)
def me(msg):
conn.msg(chan, "\x01%s %s\x01" % ("ACTION", msg))
def notice(msg): def notice(msg):
conn.cmd('NOTICE', [nick, msg]) conn.cmd('NOTICE', [nick, msg])
@ -32,7 +35,7 @@ class Input(dict):
params=params, nick=nick, user=user, host=host, params=params, nick=nick, user=user, host=host,
paraml=paraml, msg=msg, server=conn.server, chan=chan, paraml=paraml, msg=msg, server=conn.server, chan=chan,
notice=notice, say=say, reply=reply, pm=pm, bot=bot, notice=notice, say=say, reply=reply, pm=pm, bot=bot,
lastparam=paraml[-1]) me=me, lastparam=paraml[-1])
# make dict keys accessible as attributes # make dict keys accessible as attributes
def __getattr__(self, key): def __getattr__(self, key):