More refactoring! Break everything!
This commit is contained in:
parent
51c866de6d
commit
42a72f068e
6 changed files with 36 additions and 30 deletions
34
core/main.py
34
core/main.py
|
@ -13,34 +13,34 @@ class Input(dict):
|
|||
if chan == conn.nick.lower(): # is a PM
|
||||
chan = nick
|
||||
|
||||
def say(msg):
|
||||
"""sends a message to the current channel/user"""
|
||||
conn.msg(chan, msg)
|
||||
def message(message, target=chan):
|
||||
"""sends a message to a specific or current channel/user"""
|
||||
conn.msg(target, message)
|
||||
|
||||
def msg(msg, nick=nick):
|
||||
"""sends a message to a specific channel/user"""
|
||||
conn.msg(nick, msg)
|
||||
|
||||
def reply(msg, chan=chan):
|
||||
def reply(message, target=chan):
|
||||
"""sends a message to the current channel/user with a prefix"""
|
||||
if chan == nick: # PMs don't need prefixes
|
||||
conn.msg(chan, msg)
|
||||
if target == nick:
|
||||
conn.msg(target, message)
|
||||
else:
|
||||
conn.msg(chan, u'(' + nick + u') ' + msg)
|
||||
conn.msg(target, "({}) {}".format(nick, message))
|
||||
|
||||
def action(msg, chan=chan):
|
||||
def action(message, target=chan):
|
||||
"""sends an action to the current channel/user or a specific channel/user"""
|
||||
conn.msg(chan, u"\x01{} {}\x01".format("ACTION", msg))
|
||||
conn.ctcp(target, "ACTION", message)
|
||||
|
||||
def notice(msg, chan=chan):
|
||||
def ctcp(message, ctcp_type, target=chan):
|
||||
"""sends an ctcp to the current channel/user or a specific channel/user"""
|
||||
conn.ctcp(target, ctcp_type, message)
|
||||
|
||||
def notice(message, target=chan):
|
||||
"""sends a notice to the current channel/user or a specific channel/user"""
|
||||
conn.cmd('NOTICE', [chan, msg])
|
||||
conn.cmd('NOTICE', [target, message])
|
||||
|
||||
dict.__init__(self, conn=conn, raw=raw, prefix=prefix, command=command,
|
||||
params=params, nick=nick, user=user, host=host, mask=mask,
|
||||
paraml=paraml, msg=msg, server=conn.server, chan=chan,
|
||||
notice=notice, say=say, reply=reply, msg=msg, bot=bot,
|
||||
action=action, lastparam=paraml[-1])
|
||||
notice=notice, message=message, reply=reply, bot=bot,
|
||||
action=action, ctcp=ctcp, lastparam=paraml[-1])
|
||||
|
||||
# make dict keys accessible as attributes
|
||||
def __getattr__(self, key):
|
||||
|
|
Reference in a new issue