import sys
from os.path import dirname
import xchat

#sys.path.append(dirname(__file__))
sys.path.append("/home/max/.config/hexchat/addons")

__module_name__ = 'testscript'
__module_version__ = '1.00'
__module_description__ = 'bla'

class testscript:
    def __init__(self):
        self.hooks = [
            xchat.hook_command('', self.on_send_message),
            xchat.hook_unload(self.unload),
        ]

    def unload(self, userdata):
        del self

    def __del__(self):
        for hook in self.hooks:
            xchat.unhook(hook)

    # noinspection PyUnreachableCode
    def on_send_message(self, *args, **kwargs): #word, word_eol, userdata):
        print('all',locals())
        return xchat.EAT_NONE

testscript_inst = testscript()
