3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00
PyLink/plugins/hooks.py
2015-06-23 19:08:43 -07:00

15 lines
564 B
Python

# hooks.py: test of PyLink hooks
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import utils
def hook_join(irc, source, command, args):
print('%s joined channel %s (join hook caught)' % (source, args[0]))
utils.add_hook(hook_join, 'join')
def hook_msg(irc, source, command, args):
if utils.isChannel(args[0]) and irc.pseudoclient.nick in args[1]:
utils.msg(irc, args[0], 'hi there!')
print('%s said my name on channel %s (msg hook caught)' % (source, args[0]))
utils.add_hook(hook_msg, 'msg')