Exemple #1
0
    def register_event_handlers(self):
        '''
		Register an event handler to call a function
		upon connecting to the server.
		'''

        #assert hexchat.get_info("network") == "Rizon" 	# Verify we are actually on Rizon

        hexchat.hook_server(
            "XP_TE_CONNECT",
            lambda a: hexchat.prnt("Connecting event emitted."))
        hexchat.hook_server("SERVERCONNECTED", self.identify)
def greeter(word, word_eol, userdata):
    nick = word[0]
    chan = word[1]
    
    reply_hook = None
    send_hook = None
    
    def on_reply(word, word_eol, userdata):
        match = re.search('(\d\d):\d\d:\d\d', word_eol[3])
        if match:
            msg = 'Good {}'.format(daytime(match.group(1)))
        else:
            msg = 'Hello'
        
        hexchat.command('msg {} {}!'.format(chan, msg))
        
        hexchat.unhook(reply_hook)
        return hexchat.EAT_ALL
    
    def on_send(word, word_eol, userdata):
        hexchat.unhook(send_hook)
        return hexchat.EAT_ALL
    
    reply_hook = hexchat.hook_server('NOTICE', on_reply, priority=hexchat.PRI_HIGHEST)
    send_hook = hexchat.hook_print('CTCP Send', on_send, priority=hexchat.PRI_HIGHEST)
    
    hexchat.command('ctcp {} TIME'.format(nick))
    return hexchat.EAT_NONE
Exemple #3
0
 def on(s,a,b,c):
     if a[1] == "fizz":
         s.fizz = hexchat.hook_server("PRIVMSG",fizzbuzz)
         hexchat.prnt ("fizz on")
     elif a[1] == "chan":
         s.chan = hexchat.hook_server("JOIN",chanreply)
         hexchat.prnt ("chan on")
     elif a[1] == "msg":
         s.msg = hexchat.hook_server("PRIVMSG",reply)
         hexchat.prnt("msg on")
     elif a[1] == "nim":
         tmp=nim()
         s.nim = hexchat.hook_server("PRIVMSG",tmp.nimmove)
     else:
         hexchat.prnt("arguments must be valid")
     return hexchat.EAT_HEXCHAT
def xshun_cb(word,word_eol, _):
    global numerics
    xshun_timer_handle = None
    xshun_nick = None
    xshun_hooks = []

    if os.name =="nt":
        xshun_nick = getclip()        
    xshun_nick = str(xshun_nick)
    if(sys.version_info > (3, 0)):
        xshun_nick = xshun_nick[2:-1]
    #issue whois on nickname
    hexchat.command("whois " + str(xshun_nick))

    #function to be called later to unhook all numeric hooks
    def xshun_unhook():
        for hook in xshun_hooks:
            hexchat.unhook(hook)
        hexchat.unhook(xshun_timer_handle)      

    def xshun_notice_cb(word, word_eol, _):
        if word[1] == '378':
            connecting_ip =  str(word[8])
            if(connecting_ip  not in str (IRCCloud)):
                hexchat.command("shun +*@%s %s %s" % (str(connecting_ip),shun_time,shun_reason))

        return hexchat.EAT_ALL  

    def xshun_timeout_cb(_):
        xshun_unhook()

    xshun_hooks = [hexchat.hook_server(numeric, xshun_notice_cb) for numeric in numerics]   
    xshun_timer_handle = hexchat.hook_timer(1000, xshun_timeout_cb)

    return hexchat.EAT_ALL  
Exemple #5
0
	def __init__(self):
		self.givenAnswers = []
		self.questions = []
		self.quizzfile = Setting('gbquizz_quizzfile', '', 'QUIZZFILE', '/QUIZZFILE <nom du fichier>: régler le nom du fichier de quizz. Sans argument, permet de connaître ce nom de fichier.')
		self.timeHint = Setting('gbquizz_timehint', 15, 'QUIZZTIMEHINT', '/QUIZZTIMEHINT <temps en secondes>: temps restant à l\'affichage de l\'indice.')
		self.timeQuestion = Setting('gbquizz_timequestion', 60, 'QUIZZTIMEQUESTION', '/QUIZZTIMEQUESTION <temps en secondes>: durée de chaque question.')
		self.multicastEnabled = Setting('gbquizz_multicastenabled', 0, 'QUIZZMULTICAST', '/QUIZZMULTICAST <1 ou 0>: activer ou désactiver le multicast.')
		self.timePause = Setting('gbquizz_timepause', 15, 'QUIZZTIMEPAUSE', '/QUIZZTIMEPAUSE <temps en secondes>: durée de chaque pause.')
		self.channel = Setting(None, hexchat.get_info('channel'), 'QUIZZCHANNEL', '/QUIZZCHANNEL <canal>: changer le canal du bot de quizz.')
		self.tick = Setting('gbquizz_tick', 0, 'QUIZZTICK', '/QUIZZTICK <valeur>: changer la valeur du temps pour le bot.')
		self.mode = 0
		self.ignoredList = hexchat.get_pluginpref('gbquizz_ignored').split(' ')
		self.loadScores()
		self.currentAnswers = []
		hexchat.hook_command('QUIZZSTART', self.startQuizz)
		hexchat.hook_command('QUIZZSTOP', self.stop)
		hexchat.hook_command('QUESTION', self.newQuestion)
		hexchat.hook_server('PRIVMSG', self.messageHook)
		hexchat.hook_server('JOIN', self.joinHook)
		hexchat.hook_unload(self.quit)
def init():
    global frequency
    log("init", "=============------------===============")
    log("init", "initializing commands...")
    cmd = commands()
    log("init", "hooking server...")
    # hook is fired on server message/PM
    hc.hook_server("PRIVMSG",
                   cmd.parseHook)  # hooks when the user is mentioned
    # hooks fire when the associated slash-command is entered
    log("init", "hooking commands...")
    hc.hook_command("test", cmd.test)
    hc.hook_command("readOut", cmd.readOut)
    hc.hook_command("purge", cmd.purge)
    # for timed reminders, HC provides a method for triggering timed callbacks
    log("init", "Hooking timer...")
    hc.hook_timer(frequency, cmd.readOut)
    log("init", "Done!")
    log(
        "Init",
        "-----------------\n{} version {} loaded successfully!\n--------------"
        .format(__module_name__, __module_version__))
Exemple #7
0
def search_cb(word, word_eol, userdata):
	global banhook
	global quiethook
	global endbanhook
	global endquiethook

	if len(word) == 2:
		hooks = (quiethook, banhook, endquiethook, endbanhook)
		if not any(hooks):
			banhook = hexchat.hook_server ('367', banlist_cb)
			quiethook = hexchat.hook_server ('728', quietlist_cb)
			endbanhook = hexchat.hook_server ('368', endbanlist_cb, word[1])
			endquiethook = hexchat.hook_server ('729', endquietlist_cb, word[1])

			hexchat.command('ban')
			hexchat.command('quiet')
		else:
			print('A ban search is already in progress.')

	else:
		hexchat.command('help bansearch')

	return hexchat.EAT_ALL
Exemple #8
0
 def __init__(self):
     self.givenAnswers = []
     self.questions = []
     self.quizzfile = Setting(
         'gbquizz_quizzfile', '', 'QUIZZFILE',
         '/QUIZZFILE <nom du fichier>: régler le nom du fichier de quizz. Sans argument, permet de connaître ce nom de fichier.'
     )
     self.timeHint = Setting(
         'gbquizz_timehint', 15, 'QUIZZTIMEHINT',
         '/QUIZZTIMEHINT <temps en secondes>: temps restant à l\'affichage de l\'indice.'
     )
     self.timeQuestion = Setting(
         'gbquizz_timequestion', 60, 'QUIZZTIMEQUESTION',
         '/QUIZZTIMEQUESTION <temps en secondes>: durée de chaque question.'
     )
     self.multicastEnabled = Setting(
         'gbquizz_multicastenabled', 0, 'QUIZZMULTICAST',
         '/QUIZZMULTICAST <1 ou 0>: activer ou désactiver le multicast.')
     self.timePause = Setting(
         'gbquizz_timepause', 15, 'QUIZZTIMEPAUSE',
         '/QUIZZTIMEPAUSE <temps en secondes>: durée de chaque pause.')
     self.channel = Setting(
         None, hexchat.get_info('channel'), 'QUIZZCHANNEL',
         '/QUIZZCHANNEL <canal>: changer le canal du bot de quizz.')
     self.tick = Setting(
         'gbquizz_tick', 0, 'QUIZZTICK',
         '/QUIZZTICK <valeur>: changer la valeur du temps pour le bot.')
     self.mode = 0
     self.ignoredList = hexchat.get_pluginpref('gbquizz_ignored').split(' ')
     self.loadScores()
     self.currentAnswers = []
     hexchat.hook_command('QUIZZSTART', self.startQuizz)
     hexchat.hook_command('QUIZZSTOP', self.stop)
     hexchat.hook_command('QUESTION', self.newQuestion)
     hexchat.hook_server('PRIVMSG', self.messageHook)
     hexchat.hook_server('JOIN', self.joinHook)
     hexchat.hook_unload(self.quit)
Exemple #9
0
def init():
    rat_irc.init(root_path, on_console_write)

    hexchat.hook_server("PRIVMSG", handle_privmsg)
    hexchat.hook_command(
        "FR_LOG",
        lambda word, word_eol, userdata : rat_irc.handle_fr_log(word),
        help=rat_irc.fr_log_usage)
    hexchat.hook_command(
        "FR_CLIP",
        lambda word, word_eol, userdata : rat_irc.handle_fr_clip(word),
        help=rat_irc.fr_clip_usage)
    hexchat.hook_command(
        "FR_PLATFORM",
        lambda word, word_eol, userdata : rat_irc.handle_fr_platform(word),
        help=rat_irc.fr_platform_usage)
    hexchat.hook_command(
        "FR_SOUND",
        lambda word, word_eol, userdata : rat_irc.handle_fr_sound(word),
        help=rat_irc.fr_sound_usage)
    hexchat.hook_command(
        "FR_GAME_VERSION",
        lambda word, word_eol, userdata : rat_irc.handle_fr_game_version(word),
        help=rat_irc.fr_game_version_usage)
Exemple #10
0
ini_load(INI_FILE)

# the automatic thing
# does the timer automatically stop when this module is unloaded?
TIMER1 = hexchat.hook_timer(HB_TIME, _update_sites)
TIMER2 = hexchat.hook_timer(1, _update_sites_once)

# the /commands
CLIST = ''
for SITE in SITES:
  if 'command' in SITES[SITE]:
    hexchat.hook_command(SITES[SITE]['command'], checkCommand, help='show you %s age' % SITES[SITE]['name'])
    CLIST += '/' + SITES[SITE]['command'] + ' '
    hexchat.hook_command(SITES[SITE]['command'] + '_emote', checkCommand, help='announces %s age' % SITES[SITE]['name'])
    CLIST += '/' + SITES[SITE]['command'] + '_emote '
print("\002commands:\002", CLIST)
hexchat.hook_command('grubdate_dump', dump_state, help='(debug) dump SITES dict for grubdate')
print("\002debug commands:\002 /grubdate_dump")

# the triggers
CLIST = ''
for SITE in SITES:
  if 'listenfor' in SITES[SITE]:
    CLIST += SITES[SITE]['listenfor'] + ' '
print("\002triggers:\002", CLIST)
hexchat.hook_server("PRIVMSG", eat_privmsg)


# cleanup, don't wait for GC
del(CLIST, SITE)
Exemple #11
0
 def __init__(self):
     self.np_hook = hexchat.hook_server("PRIVMSG", self.spotify)
     self.last_run = 0
Exemple #12
0
def rejoin(word, word_eol, userdata):
    hexchat.command('TIMER 1 RAW JOIN %s' % word[1])
    hexchat.hook_server('474', unban, userdata=word[1])
    return hexchat.EAT_PLUGIN
Exemple #13
0
                yield y
            if not c.value:
                log(
                    2, "[" + str(netId(ctx)) +
                    "] ChanServ OP failed, aborting actions in " + channel)
                return
            log(
                1, "[" + str(netId(ctx)) + "] Opped by ChanServ in " +
                channel + ", executing actions")
        for y in executeActions(ctx, actions):
            yield y

    return hexchat.EAT_ALL


hexchat.hook_server("311", WhoisPromise.handler311)
hexchat.hook_server("330", WhoisPromise.handler330)
hexchat.hook_server("318", WhoisPromise.handler318)
for numeric in ("276", "307", "310", "312", "313", "316", "317", "319", "320",
                "335", "337", "338", "378", "379", "671"):
    hexchat.hook_server(numeric, WhoisPromise.ignoreIfQueued)
hexchat.hook_server("MODE", ChanServPromise.handlerMODE)
hexchat.hook_server("NOTICE", ChanServPromise.handlerNOTICE)
hexchat.hook_server("005", handler005)

hexchat.hook_command("cd_log", commandLog)
hexchat.hook_command("cd_flush", commandFlush)
hexchat.hook_command("cd_status", commandStatus)
hexchat.hook_command("o", command, "o")
hexchat.hook_command("d", command, "d")
hexchat.hook_command("co", command, "co")
Exemple #14
0
            return hexchat.EAT_HEXCHAT

    return hexchat.EAT_NONE


def keypress_cb(word, word_eol, userdata):
    # tab = 65289
    if word[0] != "65289":
        return hexchat.EAT_NONE

    global remote_nicks
    channel = cur_channel_id()
    autocomplete_list = remote_nicks.get(channel)
    if not autocomplete_list:
        return hexchat.EAT_NONE

    local_nicks = [user.nick for user in hexchat.get_list("users")]
    autocomplete_list = list(set(autocomplete_list + local_nicks))

    inputtext = hexchat.get_info("inputbox")
    if not inputtext:
        return hexchat.EAT_NONE
    autocomplete_list.sort(key=str.upper)
    return do_autocomplete(inputtext, autocomplete_list)


hexchat.hook_server("PRIVMSG", relayed_message)
hexchat.hook_print("Key Press", keypress_cb)

print(__module_name__, "version", __module_version__, "loaded.")
Exemple #15
0
                        s.nimmem[name] = tmp
                except:
                    hexchat.command("msg " + name + " setup must be valid")
                    del s.nimmem[name]
            elif a[3][1:] == "set":
                try:
                    #print( a[4][1] )
                    s.nimmem[name] = a[4].split(",")
                    #print s.nimmem[name]
                    s.nimmem[name] = [0] + [int(s.nimmem[name][0])
                                            ] + [int(s.nimmem[name][1])]
                except:
                    hexchat.command("msg " + name + " setup must be valid")
                    del s.nimmem[name]
            else:
                hexchat.command(
                    "msg " + name +
                    " welcome to the automated nim just privmsg me with a message in the format \"set 31(total limit),6(indlim)\" bye"
                )
        return hexchat.EAT_NONE

    def test(s, a, b):
        a -= 1
        a = a % b
        a += 1
        return a


tmp = nim()
hexchat.hook_server("privmsg", tmp.nimmove)
    channel = hexchat.get_info('channel')
    if network in list(AllUsers.keys()):
        for chan in list(AllChannels[network]):
            if chan != channel:
                users = hexchat.find_context(server=network, channel=chan).get_list('users')
                for user in users:
                    if nickname == user.nick:
                        return
        if nickname in list(AllUsers[network].keys()):
            del AllUsers[network][nickname]

def NickChange(word,word_eol,userdata):
    global AllUsers
    oldnick = word[0]
    newnick = word[1]
    network = hexchat.get_info('network')
    if oldnick in list(AllUsers[network].keys()):
        AllUsers[network][newnick] = AllUsers[network][oldnick]
        del AllUsers[network][oldnick]

hexchat.hook_command('TRY',debg)
hexchat.hook_server("352", WhoRPL)
hexchat.hook_server("315", WhoEND)
hexchat.hook_print('Part',UserPart)
hexchat.hook_print('Kick',UserKick)
hexchat.hook_print('Quit',UserQuit)
hexchat.hook_print('Change Nick',NickChange)
Timer_hk = hexchat.hook_timer(8000,WhoScanStart)
hexchat.hook_unload(unload_callback)
print("\0034" + __module_name__ + '\tVersion ' + __module_version__ + ' loaded.\003')
Exemple #17
0
def notice(word, word_eol, userdata):
    nick = word[0].split(':')[1].split('!')[0]
    where = word[2]
    if where == hexchat.get_info("nick"):
        account = nick2acc(nick)
        if account == '*':
            if '$~a' in ignores():
                if nick in reported:
                    return hexchat.EAT_ALL
                print("Ignored NOTICE from an unidentified user, %s ($~a)" %
                      nick)
                reported.append(nick)
                return hexchat.EAT_ALL
            return hexchat.EAT_NONE
        else:
            if account in ignores():
                if account in reported:
                    return hexchat.EAT_ALL
                print("Ignored NOTICE from %s ($a:%s)." % (nick, account))
                reported.append(account)
                return hexchat.EAT_ALL
    elif where.startswith('#') and ignoreChanMsgs:
        account = nick2acc(nick)
        if account in ignores():
            return hexchat.EAT_ALL


hexchat.hook_server('PRIVMSG', pm)
hexchat.hook_server('NOTICE', notice)
perchecks = hexchat.hook_timer(1200000, periodic_checks)
Exemple #18
0
def request_data(cmd, callback, params='', timeout=5000, timeoutcb=None):
    s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    # create random command name
    randcmd = ''.join(s[random.randrange(len(s))] for n in range(20))
    
    # local callback functions for the random command names
    def _local(word, word_eol, return_list):
        return_list.append((['*']+word[1:], ['* '+word_eol[1]]+word_eol[1:]))
        return hexchat.EAT_HEXCHAT
    
    def _localend(word, word_eol, ud):
        hexchat.unhook(ud[2]) #hook_id
        hexchat.unhook(ud[3]) #hook_end_id
        hexchat.unhook(ud[4]) #hook_timeout_id
        hexchat.unhook(ud[5]) #hook_421_id
        ud[1](Context(hexchat.get_context()), ud[0])
        return hexchat.EAT_HEXCHAT
    
    def _timeout(ud):
        hexchat.unhook(ud[2])
        hexchat.unhook(ud[3])
        hexchat.unhook(ud[4])
        hexchat.unhook(ud[5])
        if timeoutcb is not None:
            timeoutcb()
    
    def _notfound(word, word_eol, ud):
        if cmd.lower() == word[3].lower():
            # command was sent to server and we received a "not found"
            hexchat.prnt("Could not request data. "\
                "Command {!r} is not a hook.".format(cmd))
            hexchat.unhook(ud[2])
            hexchat.unhook(ud[3])
            hexchat.unhook(ud[4])
            hexchat.unhook(ud[5])
        return hexchat.EAT_NONE
    
    return_list = []
    userdata = []
    
    userdata.append(return_list)
    userdata.append(callback)
    
    hook_id = hexchat.hook_command(
        randcmd, _local, userdata=return_list)
    userdata.append(hook_id)
    
    hook_end_id = hexchat.hook_command(
        randcmd+'END', _localend, userdata=userdata)
    userdata.append(hook_end_id)
    
    hook_421_id = hexchat.hook_server(
        '421', _notfound, userdata=userdata)
    userdata.append(hook_421_id)
    
    if timeout > 0:
        # note: if timeout <= 0, and no hook_timer is set. if an error
        # occurs (esp. if randcmd+'END' never gets sent by the providing
        # plugin), the randcmd hooks might never get unhooked.
        hook_timeout_id = hexchat.hook_timer(
            timeout, _timeout, userdata=userdata)
        userdata.append(hook_timeout_id)
    
    # finally: call the remote command (/testi in this case)
    hexchat.command(("{} {} {}".format(cmd.strip(), randcmd, params)).strip())
    return hc.EAT_ALL


def on_client_msg(word, word_eol, userdata):
    global messaging
    if messaging:
        return
    messaging = True
    if hc.get_info("network") == "twitch" and not hc.get_info(
            "channel").startswith("#"):
        hc.command("privmsg #jtv :/w {} {}".format(hc.get_info("channel"),
                                                   word_eol[0]))
        hc.command("query -nofocus {} {}".format(hc.get_info("channel"),
                                                 word_eol[0]))
    messaging = False
    return hc.EAT_NONE


hc.hook_server('QUIT', on_quit)
hc.hook_server('PRIVMSG', on_privmsg)
hc.hook_server('JOIN', on_join)
hc.hook_server('NICK', on_nick)
hc.hook_server('KICK', on_kick)
hc.hook_server('PART', on_part)
hc.hook_server('WHISPER', on_whisper)
hc.hook_command('msg', on_client_msg)
hc.hook_command('print_msg_inbox', print_msg_inbox)
hc.hook_timer(10000, resample_doot)
hc.hook_timer(60000, updateuserlists)
hc.prnt("Main script (local.py) loaded successfully.")
Exemple #20
0
 def decorator(func):
     wrapper = Wrapper(func, on_error)
     hookid = hexchat.hook_server(cmd.upper(), wrapper, userdata, priority)
     wrapper.set_hook(hookid)
     return wrapper
Exemple #21
0
		if context:
			context.set()
			last_context_name = context_name
		else:
			last_context_name = None

def send_notice_cb(word, word_eol, userdata):
	global send_notice_hook
	to = word[1]
	context = hexchat.find_context(server=hexchat.get_info('server'), channel=to)
	if not context:
		if to.startswith('#'):
			return hexchat.EAT_NONE
		else:
			hexchat.command('QUERY -nofocus %s' % to)
		context = hexchat.find_context(server=hexchat.get_info('server'), channel=to)
	if context:
		context.set()
		hexchat.unhook(send_notice_hook)
		context.command(word_eol[0])
		send_notice_hook = hexchat.hook_command("NOTICE", send_notice_cb)
		return hexchat.EAT_ALL

def send_msg_cb(word, word_eol, userdata):
	hexchat.command('QUERY -nofocus %s' % word_eol[1])
	return hexchat.EAT_ALL

send_msg_hook = hexchat.hook_command("MSG", send_msg_cb)
send_notice_hook = hexchat.hook_command("NOTICE", send_notice_cb)
recv_notice_hook = hexchat.hook_server("NOTICE", recv_notice_cb)
def togglealerts(word, word_eol, userdata):
    setting = hexchat.get_pluginpref('aub_alertsenabled')
    if setting:
        hexchat.emit_print(
            "Notice", "AutoUB [PL]", "You have disabled alerts. To turn them on, /aubtogglealerts")
    else:
        hexchat.emit_print(
            "Notice", "AutoUB [PL]", "You have enabled alerts. To turn them off, /aubtogglealerts")
    hexchat.set_pluginpref('aub_alertsenabled', str(1 - setting))
    return hexchat.EAT_ALL


def chgcooldown(word, word_eol, userdata):
    if len(word) == 1:
        hexchat.emit_print("Notice", "AutoUB [PL]", "Current cooldown is %s seconds." % str(
            hexchat.get_pluginpref('aub_cooldown')))
        return hexchat.EAT_ALL

    hexchat.set_pluginpref('aub_cooldown', word[1])
    hexchat.emit_print("Notice", "AutoUB [PL]", "Cooldown set to %s seconds." % str(
        hexchat.get_pluginpref('aub_cooldown')))


hexchat.hook_server("474", storechan)
hexchat.hook_command("unlockautounban", unlock)
hexchat.hook_command("aubtogglealerts", togglealerts)
hexchat.hook_command("aubcooldown", chgcooldown)
hexchat.emit_print("Notice", __module_name__ + " [S]", "%s by %s loaded. You are using version %s of the script." % (
    __module_name__, __author__, __module_version__))
Exemple #23
0
        if len(word) >= 3 and word[2] != '--network':
            if word_eol[2]=="1" or word_eol[2]=="True" or word_eol[2]=="true":
                key.aes = True
            if word_eol[2]=="0" or word_eol[2]=="False" or word_eol[2]=="false":
                key.aes = False
            KEY_MAP[id_] = key
        elif len(word) >= 5 and word[2] == '--network':
            if word_eol[4]=="1" or word_eol[4]=="True" or word_eol[4]=="true":
                key.aes = True
            if word_eol[4]=="0" or word_eol[4]=="False" or word_eol[4]=="false":
                key.aes = False
        print 'Key aes', id_, 'set', key.aes
        return hexchat.EAT_ALL

import hexchat
hexchat.hook_command('key', key, help='show information or set key, /key <nick> [<--network> <network>] [new_key]')
hexchat.hook_command('key_exchange', key_exchange, help='exchange a new key, /key_exchange <nick>')
hexchat.hook_command('key_list', key_list, help='list keys, /key_list')
hexchat.hook_command('key_load', key_load, help='load keys, /key_load')
hexchat.hook_command('key_pass', key_pass, help='set key file pass, /key_pass password')
hexchat.hook_command('aes', aes, help='aes #channel/nick 1|0 or True|False')
hexchat.hook_command('key_remove', key_remove, help='remove key, /key_remove <nick>')
hexchat.hook_server('notice', dh1080)
hexchat.hook_print('Channel Message', decrypt_print, 'Channel Message')
hexchat.hook_print('Change Nick', change_nick)
hexchat.hook_print('Private Message to Dialog', decrypt_print, 'Private Message to Dialog')
hexchat.hook_server('332', server_332)
hexchat.hook_command('', encrypt_privmsg)
hexchat.hook_unload(unload)
load()
Exemple #24
0
 def __call__(self, func):
     cmd = self._get_handle_mapping(slug_command(func.__name__))
     cmd['func'] = func
     cmd['func_args'] = inspect.getfullargspec(func)
     hexchat.hook_server('PRIVMSG', self._callback)
     return func
Exemple #25
0
    eg: /UNNIGNORE 0
    Removes the user from the nick change ignore list
    See also: NIGNORE, LIGNORE""",
    "lnignore":
    """/LNIGNORE
    eg: /LNIGNORE
    Shows the users currently ignore by the /NIGNORE command
    See also: NIGNORE, UNNIGNORE"""
}


def unhook(dt):
    if hook:
        hexchat.unhook(hook)


def unload_cb(dt):
    hexchat.prnt("{0} module is unloaded".format(__module_name__))


loadconf()

hexchat.hook_command('NIGNORE', setignorer, help=help['nignore'])
hexchat.hook_command('LNIGNORE', listi, help=help['lnignore'])
hook = hexchat.hook_server('NICK', on_nick, priority=hexchat.PRI_HIGHEST)
hexchat.hook_command('UNNIGNORE', unset, help=help['unnignore'])
hexchat.hook_unload(unhook)
hexchat.hook_unload(unload_cb)
print("{0} module version {1} by {2} loaded.".format(__module_name__,
                                                     __module_version__,
                                                     __module_author__))
    Ignores the nick changes made by the user (even the user list won't change)
    To deactivate, see /help UNNIGNORE
    See also: UNNIGNORE, LNIGNORE""",

    "unnignore": """/UNNIGNORE <index>
    eg: /UNNIGNORE 0
    Removes the user from the nick change ignore list
    See also: NIGNORE, LIGNORE""",

    "lnignore": """/LNIGNORE
    eg: /LNIGNORE
    Shows the users currently ignore by the /NIGNORE command
    See also: NIGNORE, UNNIGNORE"""
}

def unhook(dt):
    if hook:
        hexchat.unhook(hook)

def unload_cb(dt):
    hexchat.prnt("{0} module is unloaded".format(__module_name__))

loadconf()

hexchat.hook_command('NIGNORE',setignorer,help=help['nignore'])
hexchat.hook_command('LNIGNORE',listi,help=help['lnignore'])
hook = hexchat.hook_server('NICK',on_nick,priority=hexchat.PRI_HIGHEST)
hexchat.hook_command('UNNIGNORE',unset,help=help['unnignore'])
hexchat.hook_unload(unhook)
hexchat.hook_unload(unload_cb)
print("{0} module version {1} by {2} loaded.".format(__module_name__, __module_version__, __module_author__))
def fullversioncmd(word, word_eol, userdata):
    global hook, hookend
    hook = hexchat.hook_server("364", links_cb)
    hookend = hexchat.hook_server("365", links_cb)
    hexchat.command("LINKS")
    return hexchat.EAT_HEXCHAT
Exemple #28
0
            hexchat.command('say /{} {}'.format(alias, word_eol[1]))
        else:
            hexchat.command('say /{}'.format(alias))
    else:
        hexchat.command('say /{}'.format(word_eol[0]))
    return hexchat.EAT_ALL


for command in commands:
    hexchat.hook_command(command, command_cb)
for command, alias in aliases.items():
    hexchat.hook_command(command, command_cb, alias)
hexchat.hook_command('', my_saymsg_cb)
hexchat.hook_command('msg', my_msg_cb)
hexchat.hook_command('notice', my_msg_cb)
hexchat.hook_server('421', servererr_cb)
hexchat.hook_server('PRIVMSG', privmsg_cb)
hexchat.hook_server('CLEARCHAT', clearchat_cb)
hexchat.hook_server('WHISPER', whisper_cb)
hexchat.hook_server('RECONNECT', reconnect_cb)
hexchat.hook_server('HOSTTARGET', hosttarget_cb)
hexchat.hook_server('USERSTATE', eatall)
hexchat.hook_server('GLOBALUSERSTATE', eatall)
hexchat.hook_server('HISTORYEND', eatall)
hexchat.hook_server('SPECIALUSER', eatall)
hexchat.hook_server('ROOMSTATE', eatall)
hexchat.hook_print('Your Message', yourmsg_cb)
hexchat.hook_print('Your Action', youract_cb)
# Obsolete
# hexchat.hook_server('EMOTESET', eatall)
# hexchat.hook_server('USERCOLOR', eatall)
Exemple #29
0
        if super.check_debug():
            print("This :D brought to you by: " + word_eol[0])
    return hexchat.EAT_NONE


def rejoin(userdata):
    hook = rejoin_hooks[userdata]
    del rejoin_hooks[userdata]
    hexchat.unhook(hook)
    print("Rejoining {} now…".format(userdata))
    hexchat.command("join " + userdata)
    return hexchat.EAT_NONE


def handle_kick(word, word_eol, userdata):
    channel = hexchat.get_info("channel")
    if (hexchat.nickcmp(channel, userdata) == 0):
        if (hexchat.nickcmp(word[3], hexchat.get_info("nick")) == 0):
            print("Kicked from {}. Rejoining in {}ms…".format(
                channel, rejoin_delay))
            rejoin_hooks[channel] = hexchat.hook_timer(rejoin_delay, rejoin,
                                                       channel)
    return hexchat.EAT_NONE


for channel in responding_channels:
    hexchat.command("join " + channel)
    hexchat.hook_server("KICK", handle_kick, channel)
    for command in triggering_commands:
        hexchat.hook_server(command, responder_hook, channel)
Exemple #30
0
        ip = word[4]
        url = 'https://api.abuseipdb.com/api/v2/check'
        querystring = {'ipAddress': ip, 'maxAgeInDays': '90'}
        headers = {
            'Accept':
            'application/json',
            'Key':
            '1fe37ff7b82cd6fa07325bd6fad580a105ca94ada5b03d4b5a5143d558a72fa7c7909eb33922424a'
        }
        response = requests.request(method='GET',
                                    url=url,
                                    headers=headers,
                                    params=querystring)
        decodedResponse = json.loads(response.text)
        for output in decodedResponse.itervalues():
            ipAddress = output['ipAddress']
            countryCode = output['countryCode']
            abuseConfidenceScore = output['abuseConfidenceScore']
            abuse = str(abuseConfidenceScore)
        hexchat.command("PRIVMSG #altay " + 'Address: ' + ipAddress)
        hexchat.command("PRIVMSG #altay " + 'AbuseLevel: ' + abuse + ' %')
        hexchat.command("PRIVMSG #altay " + 'Country: ' + countryCode)
        hexchat.command("PRIVMSG #altay " +
                        'Host details on https://www.abuseipdb.com/check/' +
                        ipAddress)
        return hexchat.EAT_ALL


hexchat.hook_server('PRIVMSG', ip_info)
hexchat.hook_print("notice", ip_info)
Exemple #31
0
        return hexchat.EAT_ALL


# Eat any message starting with a '.', twitch eats all of them too.
@twitchOnly
def yourmsg_cb(word, word_eol, userdata):
    if word[1][0] == ".":
        return hexchat.EAT_ALL


# Just prefix with a '.'.
@twitchOnly
def command_cb(word, word_eol, alias):
    if alias:
        if len(word_eol) > 1:
            hexchat.command("say .{} {}".format(alias, word_eol[1]))
        else:
            hexchat.command("say .{}".format(alias))
    else:
        hexchat.command("say .{}".format(word_eol[0]))
    return hexchat.EAT_ALL


for command in commands:
    hexchat.hook_command(command, command_cb)
for command, alias in aliases.items():
    hexchat.hook_command(command, command_cb, alias)
hexchat.hook_print("Your Message", yourmsg_cb)
hexchat.hook_server("421", servererr_cb)
hexchat.hook_server("PRIVMSG", privmsg_cb)
import hexchat

__module_name__ = "kill007"
__module_description__ = "removes 007s from raw lines"
__module_version__ = "0.5"


def remove(word, word_eol, userdata):
    if "\007" in word_eol[0]:
        hexchat.command("recv {}".format(word_eol[0].replace(
            "\007", "\\007")))
        return hexchat.EAT_ALL


@hexchat.hook_unload
def onunload(userdata):
    print(__module_name__, "plugin unloaded")

hexchat.hook_server("RAW LINE", remove)
print(__module_name__, "plugin loaded")
__module_name__ = "stop SPAM"
__module_version__ = "1.5 for xchat"
__module_description__ = "stop SPAM: SAO is still bad"
import hexchat

botcommands = {
    ':!find', ':@find', ':/msg', ':/MSG', ':!new', ':!list', ':!search',
    ':!FIND', ':@FIND', ':!packlist', ':!help'
}

badwords = {'sao', 'SAO'}


def stopSPAM(word, word_eol, userdata):
    if word[3].lower() in botcommands:
        return hexchat.EAT_ALL
    if any(substring in word_eol[2].lower() for substring in badwords):
        return hexchat.EAT_ALL
    else:
        return hexchat.EAT_NONE


hexchat.hook_server('PRIVMSG', stopSPAM)
Exemple #34
0
        else:
            debugPartReasP = False

        if debugPartReasP:
            self.debugPrint("debugPartReasP: " + word_eol[0])
            self.debugPrint("attribs:    " + repr(attribs))

        return hexchat.EAT_NONE


# make an object of the class which contains all of the above funcs as methods
irc_subst_obj = irc_subst(pathname)

# establish the hook to the input method, immediately above
hexchat.hook_command('', irc_subst_obj.inputHook)

# establish the hook to the notice method of irc_subst, above
hexchat.hook_server('NOTICE', irc_subst_obj.notice_hook)

# establish the hook to the join_hook method of irc_subst, above
hexchat.hook_print_attrs('Join', irc_subst_obj.join_hook)

# establish the hooks to the part_hook and partreas_hook methods of irc_subst, above
hexchat.hook_print_attrs('Part', irc_subst_obj.part_hook)
hexchat.hook_print_attrs('Part with Reason', irc_subst_obj.partreas_hook)

# establish for channel, and for private, messages
hexchat.hook_print_attrs('Channel Message', irc_subst_obj.channel_msg_hook)
hexchat.hook_print_attrs('Private Message', irc_subst_obj.private_msg_hook)
hexchat.hook_print_attrs('Private Message to Dialog', irc_subst_obj.private_dialog_msg_hook)
        if length == 2 and data['nick'] in ADMIN_ACCESS:
            set_now_playing_source(command_data[1])
        if not on_cooldown(data['nick']):
            now_playing()
            
    if cmd == '!viewers':
        if not on_cooldown(data['nick']):
            # channel starts with hash
            say(Twitch.get_channel_views(data['channel'][1:], data['nick']))

    if cmd == "!status":
        if not on_cooldown(data['nick']):
            # channel starts with hash
            response = Twitch.get_hosted_channel(data['channel'][1:], data['nick'])
            if response:
                say(response)

    if cmd == "!bookmark":
        if not on_cooldown(data['nick']):
            if length == 1:
                msg = "{0} -> Usage: !bookmark TITLE | http://www.twitch.tv/low_tier_bot/profile/bookmarks".format(data['nick'])
                say(msg)
            elif length > 1 and is_mod(data['nick']):
                Twitch.create_twitch_bookmark(data['channel'], data['message'], data['nick'], PASS_FILE)
            

hexchat.hook_unload(db_unload)
hexchat.hook_server('PRIVMSG', process)
hexchat.hook_timer(120000, db_commit)

hexchat.prnt(__module_name__ + " v" + __module_version__ + " has been loaded.")
        query_whois(user)

def isbanned(w, we, udata):
    start_search(w[1], we[2], "b")
    return hexchat.EAT_ALL

def ismuted(w, we, udata):
    start_search(w[1], we[2], "q")
    query_list(w[1], "b")
    return hexchat.EAT_ALL

def islisted(w, we, udata):
    start_search(w[1], we[3], w[2].lstrip("+"))
    return hexchat.EAT_ALL

hexchat.hook_server("329", ignored)
hexchat.hook_server("276", ignored)
hexchat.hook_server("317", ignored)
hexchat.hook_server("378", ignored)
hexchat.hook_server("319", ignored)
hexchat.hook_server("312", ignored)
hexchat.hook_server("324", modes)
hexchat.hook_server("367", list_entry, "+b")
hexchat.hook_server("728", list_entry, "+q")
hexchat.hook_server("346", list_entry, "+I")
hexchat.hook_server("348", list_entry, "+e")
hexchat.hook_server("368", list_end)
hexchat.hook_server("729", list_end)
hexchat.hook_server("347", list_end)
hexchat.hook_server("349", list_end)
hexchat.hook_server("502", no_modes)
	current_tab = hexchat.find_context()
	if not current_tab:
		return hexchat.EAT_NONE

	nick = word[0].split("!")[0].replace(":", "")
	noticecontent = getnoticetext(word)
	if nick and noticecontent:
		notice_network = hexchat.get_info("network")
		notice_host = hexchat.get_info("host")
		currenttab_network = current_tab.get_info("network")
		if notice_network == currenttab_network:
			current_tab.emit_print("Notice", nick, noticecontent)
		else:
			current_tab.emit_print("Notice", nick, "(%s / %s): %s" % (notice_network, notice_host, noticecontent))
	return hexchat.EAT_ALL
hexchat.hook_server("NOTICE", processNotice)

def getnoticetext(noticedata):
	current_word = 3 # server, NOTICE, nick
	notice_content = []
	while current_word < len(noticedata):
		if noticedata[current_word] == "":
			continue

		if noticedata[current_word][0] == ":" and current_word == 3:
			noticedata[current_word] = noticedata[current_word][1:]

		notice_content.append(noticedata[current_word])
		current_word = current_word + 1

	return ' '.join(notice_content)
Exemple #38
0
import hexchat
__module_name__ = "fizzbuzz"
__module_version__ = "1.0"
__module_description__ = "plays fizz buzz on command"

def fizzbuzz(a,b,c):
    for i in range(1,100):
        if i%3:
            if i%5:
                hexchat.command("say "+str(i))
            else:
                hexchat.command("say fizzbuzz")
        else:
            if i%5:
                hexchat.command("say fizz")
            else:
                hexchat.command("say fizzbuzz"))
    return hexchat.EAT_NONE
hexchat.hook_server("PRIVMSG",fizzbuzz)
print("init")
Exemple #39
0
        elif _type == 'quit':
            hexchat.emit_print("Quit", nick, args[15:-1], host)
        elif _type == 'kicked':
            hexchat.emit_print("Kick", nick, word[5], channel,
                               word_eol[6][9:-1])
        elif _type == 'changed':
            hexchat.emit_print("Topic Change", nick, args[14:], channel)
        else:
            hexchat.emit_print("Server Error", "Unhandled *buffextras event:")
            hexchat.emit_print("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('PRIVMSG', privmsg)
Exemple #40
0
    # Store all pending changes to the database
    helper.gatodb_commit()
    # Disconnect everything else
    hexchat.unhook(HOOKANTISPAM)
    hexchat.unhook(HOOKANTIADD)
    hexchat.unhook(HOOKANTILIST)
    hexchat.unhook(HOOKANTIDEL)
    hexchat.unhook(HOOKDEBUG)


#############################################################################
# Hook all callbacks with their respective commands
#############################################################################

# Antispam
HOOKANTISPAM = hexchat.hook_server('PRIVMSG', antispam_cb, userdata=None,
                                   priority=5)
HOOKANTIADD = hexchat.hook_command('antiadd', antispam_add_cb)
HOOKANTILIST = hexchat.hook_command('antilist', antispam_list_cb)
HOOKANTIDEL = hexchat.hook_command('antidel', antispam_del_cb)
HOOKDEBUG = hexchat.hook_command('asdebug', antispam_debug_cb)


#############################################################################
# Add menu options
#############################################################################
hexchat.command('menu ADD "GatoScript/-"')
hexchat.command('menu ADD "GatoScript/AntiSpam"')
hexchat.command('menu ADD "GatoScript/AntiSpam/Filters list" "antilist"')
hexchat.command('menu ADD "GatoScript/AntiSpam/Add filter" "getstr \b \
              "antiadd" "Filter:""')
hexchat.command('menu ADD "GatoScript/AntiSpam/Remove filter" "getstr \b \
    # if one of channels, keywords, blacklist, commands is not list convert to single item list and save it that way

    if type(conf["settings"]["channels"]) is not list:
        conf["settings"]["channels"] = [conf["settings"]["channels"]]
    if type(conf["settings"]["keywords"]) is not list:
        conf["settings"]["keywords"] = [conf["settings"]["keywords"]]
    if type(conf["settings"]["blacklist"]) is not list:
        conf["settings"]["blacklist"] = [conf["settings"]["blacklist"]]
    if type(conf["settings"]["commands"]) is not list:
        conf["settings"]["commands"] = [conf["settings"]["commands"]]
    conf.write()
    #now turn it into a friendly form.
    conf2 = conf["settings"]
    def msg_cb(word, word_eol, userdata):
        nick = word[0][1:].split("!")[0]
        channel = word[2]
        message = word_eol[3][1:]
        # we don't want blacklisted users to spam our script, do we?
        if channel in conf2["channels"] and nick not in conf2["blacklist"]:
            for keyword in conf2["keywords"]:
                if re.findall(keyword, message.lower()):
                    hexchat.emit_print("Channel Message", nick, message, "")
                    hexchat.command("notice "+hexchat.get_info("nick")+" :"+conf2["message"].format(nick=nick,channel=channel,message=message, color="\x03", bold="\x02", reset="\x0F"))
                    for command in conf2["commands"]:
                        hexchat.command(command.format(nick=nick,channel=channel,message=message))
                    break
        return hexchat.EAT_ALL

    hexchat.hook_server("PRIVMSG", msg_cb)

    print "SomeoneWantsCloak! loaded..."
Exemple #42
0

def format(string, special=0):
    if (special):
        string = string.replace(string[:1], '')
    string = '\002\035' + string
    hexchat.prnt(string)


def loadJSON(url):
    try:
        with urllib.urlopen(url, timeout=3) as data:
            obj = json.loads(data.readall().decode('utf-8'))
            return obj
    except Exception:
        return json.dumps(None)


hexchat.hook_server('PRIVMSG', checkmessage_cb)
hexchat.hook_command(
    'STREAM',
    stream_cb,
    help="/STREAM Use in twitch.tv chats to check if the stream is online.")
hexchat.hook_command('UPTIME', uptime_cb)

hexchat.hook_unload(unload_cb)

timerHook = hexchat.hook_timer(10000, checkStreams_cb)

hexchat.prnt("\00304" + __module_name__ + __module_version__ +
             "successfully loaded.\003")
Exemple #43
0
__module_name__ = "blinkonprivate"
__module_version__ = "1.0.0"
__module_description__ = "Blink tray icon whenever nick is mentioned in private window."
__module_author__ = "gpiccoli"

import hexchat


def privmsg(word, word_eol, userdata):
    if hexchat.get_info("nick") in word_eol[3]:
        hexchat.command("TRAY -i 5")
    return hexchat.EAT_NONE


hexchat.hook_server("PRIVMSG", privmsg)
Exemple #44
0
        query_whois(user)

def isbanned(w, we, udata):
    start_search(w[1], we[2], "b")
    return hexchat.EAT_ALL

def ismuted(w, we, udata):
    start_search(w[1], we[2], "q")
    query_list(w[1], "b")
    return hexchat.EAT_ALL

def islisted(w, we, udata):
    start_search(w[1], we[3], w[2].lstrip("+"))
    return hexchat.EAT_ALL

hexchat.hook_server("329", ignored)
hexchat.hook_server("276", ignored)
hexchat.hook_server("317", ignored)
hexchat.hook_server("378", ignored)
hexchat.hook_server("319", ignored)
hexchat.hook_server("312", ignored)
hexchat.hook_server("324", modes)
hexchat.hook_server("367", list_entry, "+b")
hexchat.hook_server("728", list_entry, "+q")
hexchat.hook_server("346", list_entry, "+I")
hexchat.hook_server("348", list_entry, "+e")
hexchat.hook_server("368", list_end)
hexchat.hook_server("729", list_end)
hexchat.hook_server("347", list_end)
hexchat.hook_server("349", list_end)
hexchat.hook_server("502", no_modes)
Exemple #45
0
    if word[2] == public_channel:
        googl = re.search("goo.gl", word_eol[0])
        if googl:
            pub.command("KICK "+nameFilter(word[0])+" No short URLs please")
        return hexchat.EAT_NONE

def devChathook (word, word_eol, attr):
    if word[2] == private_channel:
        return hexchat.EAT_NONE

def pubJoinhook (word, word_eol, attr):
    sleep(1)
    if word[2] == public_channel:
        list = hexchat.get_list("users")
        nick_filtered = nameFilter(word[0])
        power = ''
        for x in list:
            if x.nick == nick_filtered:
                power = x.prefix
        if power == '':
            pub.command("NOTICE "+format(nick_filtered)+" :Welcome to #eldorito! Please read the topic for the latest announcements and rules!")
            return hexchat.EAT_NONE

def devJoinhook (word, word_eol, attr):
    if word[2] == private_channel:
        return hexchat.EAT_NONE

hexchat.hook_server("PRIVMSG", pubChathook)
hexchat.hook_server("PRIVMSG", devChathook)
hexchat.hook_server("JOIN", pubJoinhook)
hexchat.hook_server("JOIN", devJoinhook)
Exemple #46
0
            print('{0} is not whitelisted'.format(channel))
            continue

        whitelist.remove(channel)
        print('{0} has been removed from the whitelist'.format(channel))

    set_whitelist(whitelist)


def get_whitelist():
    whitelist = hexchat.get_pluginpref('hxnotify_whitelist')

    # ensure we got something back
    if whitelist is None:
        return []

    # remove blanks
    return [w for w in whitelist.split(',') if w.strip()]


def set_whitelist(whitelist):
    # remove blanks
    whitelist = [w for w in whitelist if w.strip()]
    hexchat.set_pluginpref('hxnotify_whitelist', str.join(',', whitelist))

hexchat.hook_command("hxnotify", hxnotify_cb, help=HXNOTIFY_HELP)
hexchat.hook_server("730", friend_online)
hexchat.hook_server("731", friend_offline)
hexchat.hook_server("PRIVMSG", channel_msg)
print("Loaded " + __module_name__ + " v" + __module_version__)
Exemple #47
0
    for item in ignore_list:
        if user in item.mask:
            return True
    return False

def route(data):
    """ Handle command calls """
    cmd_data = data['message'].split()
    length = len(cmd_data)
    
    if cmd_data[0] != "!words":
        return
    elif length >= 2 and cmd_data[1] == "everyone":
            most_spoken_words(data['nick'])
    elif length >= 3:
        if cmd_data[1] == "user":
            user_top_words(data['nick'], cmd_data[2])
        elif cmd_data[1] == "word":
            word_top_users(data['nick'], cmd_data[2])
        else:
            wc_print_usage(data['nick'])
    else:
        wc_print_usage(data['nick'])


hexchat.hook_server('PRIVMSG', parse)
hexchat.hook_unload(unload_cb)
hexchat.hook_command("wc_delete_user", delete_user_cb, help="/wc_delete_user [name] Removes user from database")
hexchat.hook_command("wc_delete_entry", delete_entry_cb, help="/wc_delete_entry [name] [word] Removes entry from database")

hexchat.prnt(__module_name__ + " v" + __module_version__ + " has been loaded.")
Exemple #48
0
    # networks={'freenode':[chan1, chan2, chan3], 'dalnet':[]}
    for chan in channels:
        if chan.type == 2 or chan.type == 3: # Ignore notices and server tabs
            networks[chan.network].append(chan.channel)

    # Iterate 'networks' and store in hexchat.pluginpref as
    # session_freenode = chan1,chan2. This is written to
    # 'addon_python.conf' eventually.
    for network, channels in networks.items():
        if len(network):
            hexchat.set_pluginpref('session_' + network, ','.join(channels))
    return hexchat.EAT_ALL


#-----------------------------------------------------------------------
# Load the previous session:
# 1. Setup a hook for '376' RPL_ENDOFMOTD (RFC-1459). When we receive
# this we know we are connected to the server and can connect to its
# channels.
# 2. Load the servers, every time you receive their 'motd' the
# corresponding channels are loaded
hexchat.hook_server('376', setup_channels)

tab_data = get_tab_data()
for network in tab_data.keys():
    connect_server(network)


hexchat.hook_timer(10000, save_session) # Save every x minutes
# hexchat.hook_unload(save_session) # Doesn't work with X11 Quit
Exemple #49
0
import hexchat

__module_name__ = "Auto Ghost"
__module_version__ = "0.1"
__module_description__ = "Automatic ghostig"


def ghost(word, word_eol, userdata):
    nickname = hexchat.get_prefs("irc_nick1")
    password = hexchat.get_info("nickserv")

    hexchat.command("nickserv ghost %s %s" % (nickname, password))
    hexchat.command("nick %s" % nickname)
    hexchat.command("nickserv identify %s" % password)
    return hexchat.EAT_NONE


hexchat.hook_server("433", ghost, priority=hexchat.PRI_HIGHEST)
		format(user.title() + " has been streaming for " + str(combineddate))
	except Exception:
		format(user.title() + " is not streaming.")

def unload_cb(userdata):
	hexchat.prnt("\00304" + __module_name__ + __module_version__ + "successfully unloaded.\003")

def format(string, special=0):
	if(special):
		string = string.replace(string[:1],'')
	string = '\002\035' + string
	hexchat.prnt(string)

def loadJSON(url):
	try:
		with urllib.urlopen(url, timeout=3) as data:
			obj = json.loads(data.readall().decode('utf-8'))
			return obj
	except Exception:
		return json.dumps(None)

hexchat.hook_server('PRIVMSG', checkmessage_cb)
hexchat.hook_command('STREAM', stream_cb, help ="/STREAM Use in twitch.tv chats to check if the stream is online.")
hexchat.hook_command('UPTIME', uptime_cb)

hexchat.hook_unload(unload_cb)

timerHook = hexchat.hook_timer(10000, checkStreams_cb)


hexchat.prnt("\00304" + __module_name__ + __module_version__ + "successfully loaded.\003")
import hexchat

__module_name__ = 'AutoIdentify'
__module_version__ = '1.0'
__module_description__ = ''

hexchat.prnt('AutoIdentify script loaded')

nicks = ('Arnavion', 'AtashiCon',)
ghosting_nick = 'Arnavion3'

def autoidentify_callback(word, word_eol, user_data):
	result = hexchat.EAT_NONE
	
	nickname = word[3]
	password = hexchat.get_info('password')
	
	if nickname in nicks and password:
		if word[2] != ghosting_nick:
			hexchat.command('nick {0}'.format(ghosting_nick))
		
		hexchat.command('ghost {0} {1}'.format(nickname, password))
		hexchat.command('nick {0}'.format(nickname))
		hexchat.command('id {0}'.format(password))
		result = hexchat.EAT_HEXCHAT
	
	return result

hexchat.hook_server('433', autoidentify_callback, priority=hexchat.PRI_HIGHEST)
Exemple #52
0
			return hexchat.EAT_ALL
		elif word[3] in (':USERCOLOR', ':USERSTATE', ':HISTORYEND', ':EMOTESET', ':CLEARCHAT', ':SPECIALUSER'):
			return hexchat.EAT_ALL

# Eat any message starting with a '.', twitch eats all of them too.
@twitchOnly
def yourmsg_cb(word, word_eol, userdata):
	if word[1][0] == '.':
		return hexchat.EAT_ALL

# Just prefix with a '.'.
@twitchOnly
def command_cb(word, word_eol, alias):
	if alias:
		if len(word_eol) > 1:
			hexchat.command('say .{} {}'.format(alias, word_eol[1]))
		else:
			hexchat.command('say .{}'.format(alias))
	else:
		hexchat.command('say .{}'.format(word_eol[0]))
	return hexchat.EAT_ALL

for command in commands:
	hexchat.hook_command(command, command_cb)
for command, alias in aliases.items():
	hexchat.hook_command(command, command_cb, alias)
hexchat.hook_print('Your Message', yourmsg_cb)
hexchat.hook_server('421', servererr_cb)
#hexchat.hook_server('376', endofmotd_cb)
hexchat.hook_server('PRIVMSG', privmsg_cb)
__module_name__ = 'Twitch Garbage Filter'
__module_version__ = '0.2'
__module_description__ = 'Filters some garbage messages'

import hexchat

filter = ["USERSTATE", "ROOMSTATE", "CLEARCHAT", "HOSTTARGET"]

def rawgarbage_cb(word, word_eol, userdata):
    if word[1] in filter:
        # print("RAW: {}".format(word))
        if word[1] == "CLEARCHAT":
            print("\00304Chat was cleared by a moderator\003")
        return hexchat.EAT_HEXCHAT

hexchat.hook_server("RAW LINE", rawgarbage_cb)

print("\00304{} v{} successfully loaded.\003".format(__module_name__, __module_version__))