Ejemplo n.º 1
0
        elif _type == 'quit':
            send("Quit", nick, args[15:-1], userhost)
        elif _type == 'kicked':
            send("Kick", nick, word[5], channel,
                 word_eol[6][9:-1])
        elif _type == 'changed':
            send("Topic Change", nick, args[14:], channel)
        else:
            send("Server Error", "Unhandled *buffextras event:")
            send("Server Error",
                 "    {}".format(word_eol[3][1:]))
        return hexchat.EAT_HEXCHAT

    return hexchat.EAT_NONE


# extra tools
def split_prefix(prefix):

    if '!' in prefix:
        nick, _, userhostpart = prefix.partition('!')
        user, _, host = userhostpart.partition('@')
    else:
        nick, _, host = prefix.partition('@')
        user = ''

    return (nick, user, host)


hexchat.hook_server_attrs('PRIVMSG', privmsg)
Ejemplo n.º 2
0
def disignore(word, word_eol, userdata):
    printlist()
    return hexchat.EAT_ALL


def printlist():
    global ignorelist
    global botlist
    if len(ignorelist) == 0:
        hexchat.prnt('Ignorelist is empty')
    else:
        hexchat.prnt('Ignorelist: ' + ', '.join(ignorelist))
    if len(botlist) == 0:
        hexchat.prnt('Botlist is empty')
    else:
        hexchat.prnt('Bot List: ' +
                     ', '.join("{!s}={!r}".format(key, val)
                               for (key, val) in botlist.items()))


loadlist()
hexchat.hook_command("addignore", addignore)
hexchat.hook_command("delignore", delignore)
hexchat.hook_command("ignorelist", disignore)
hexchat.hook_command("addbot", addbot)
hexchat.hook_command("delbot", delbot)
hexchat.hook_server_attrs('PRIVMSG', privmsg)

hexchat.prnt(__module_name__ + " " + __module_version__ + " loaded!")
printlist()
Ejemplo n.º 3
0
            # :nick!ident@host quit with message: [Quit: Leaving.]
            send("Quit", nick, args[15:-1], userhost)
        elif _type == 'kicked':
            send("Kick", nick, word[5], channel,
                 word_eol[6][9:-1])
        elif _type == 'changed':
            send("Topic Change", nick, args[14:], channel)
        else:
            send("Server Error", "Unhandled *buffextras event:")
            send("Server Error",
                 "    {}".format(word_eol[3][1:]))
        return hexchat.EAT_ALL

    return hexchat.EAT_NONE


# extra tools
def split_prefix(prefix):

    if '!' in prefix:
        nick, _, userhostpart = prefix.partition('!')
        user, _, host = userhostpart.partition('@')
    else:
        nick, _, host = prefix.partition('@')
        user = ''

    return (nick, user, host)


hexchat.hook_server_attrs('PRIVMSG', privmsg, priority=hexchat.PRI_HIGHEST)
Ejemplo n.º 4
0

def connection(word, word_eol, userdata, attributes):
    """
    Display all messages at once 5 seconds after a connection.

    That way, messages can be sorted by time instead of
    having all from one channel, then all from another, etc.
    """
    global waiting
    waiting += 1
    hexchat.command('timer 5 backlog')


# Get last hilight (so we don't print hls already seen from backlogs)
previous_session_last_hl = hexchat.get_pluginpref(PREF)
if previous_session_last_hl:
    previous_session_last_hl = int(previous_session_last_hl)
    last_hl = previous_session_last_hl
else:
    previous_session_last_hl = 0
    last_hl = 0

hexchat.hook_print_attrs('Channel Msg Hilight', message)
hexchat.hook_print_attrs('Channel Action Hilight', message)
hexchat.hook_command('backlog', forcePrint)
# 376: RPL_ENDOFMOTD (just before starting receiving backlogs if any)
hexchat.hook_server_attrs('376', connection)

print('%s\tLoaded' % __module_name__)
Ejemplo n.º 5
0
 def decorator(func):
     wrapper = Wrapper(func, on_error)
     hookid = hexchat.hook_server_attrs(cmd.upper(), wrapper, userdata,
                                        priority)
     wrapper.set_hook(hookid)
     return wrapper
Ejemplo n.º 6
0
def server_attrs(msg, cb):
	return hexchat.hook_server_attrs(msg, twitchOnly(cb), msg)
Ejemplo n.º 7
0
def server_attrs(msg, cb):
    return hexchat.hook_server_attrs(msg, twitchOnly(cb), msg)
Ejemplo n.º 8
0
 def decorator(func):
     wrapper = Wrapper(func, on_error)
     hookid = hexchat.hook_server_attrs(cmd.upper(), wrapper, userdata, priority)
     wrapper.set_hook(hookid)
     return wrapper