Exemplo n.º 1
0
def toggle_autopaste(*args):
    global autopaste_handler
    words = args[0]
    bools = {True: ("1", "on", "true", "t"), False: ("0", "off", "false", "f")}
    try:
        requested = words[1]
    except IndexError: # oh god
        requested = ""

# TODO
# /fc_autopaste off
# 074 [21:02:11] [Floodcontrol]  disabling autopaste
# /fc_autopaste off
# 074 [21:02:15]  Traceback (most recent call last):
# 074 [21:02:15]    File "/home/user/.config/hexchat/addons_wip/floodcontrol/floodcontrol.py", line 801, in toggle_autopaste
# 074 [21:02:15]      if requested.lower() in v:
# 074 [21:02:15]  SystemError: ../Objects/longobject.c:426: bad argument to internal function
    print_debug("toggle_autopaste requested", requested)
    if not autopaste_handler and requested.lower() not in bools[False]:
        print_fc("enabling autopaste")
        set_option("autopaste", "on")
        autopaste_handler = hexchat.hook_print("Key Press", keypress_cb)
    elif requested.lower() not in bools[True]:
        print_fc("disabling autopaste")
        set_option("autopaste", "off")
        hexchat.unhook(autopaste_handler)
        autopaste_handler = None
def on_unload(userdata):
    global hooks
    for hook in hooks:
        if hook is not None:
            hexchat.unhook(hook)
    del hooks[:]
    print("Send Multiple Channels unloaded")
Exemplo n.º 3
0
def checkStreams():
	global firstRun
	if(firstRun):
		hexchat.unhook(timerHook)
		hexchat.hook_timer(300000, checkStreams_cb)
		firstRun = False

	channels = hexchat.get_list("channels")
	realChannels = []
	channelObjects = {}
	for channel in channels:
		if(channel.server == "tmi.twitch.tv" and channel.channel[0] == '#'):
			realChannels.append(channel.channel.strip('#'))
			channelObjects[channel.channel.strip('#')] = channel
	if len(realChannels) > 0:
		streams = ",".join(realChannels)
		obj = loadJSON('https://api.twitch.tv/kraken/streams?channel=' + streams)
		# Returns only streams that are currently live, but returns them all in one go.
		if (obj is not None):
			streamData = {}
			for stream in obj["streams"]:
				streamData[stream["channel"]["name"]] = stream
			for channel in realChannels:
				newTopic = "\00318{0}\00399 - \00320\002OFFLINE\002\00399 | \035Stream is offline\017".format(channel)
				if (channel in streamData):
					newTopic = "\00318{0}\00399 - \00319\002LIVE\002\00399 for {1} viewers | Now playing: \00318{2}\00399 | {3}".format(streamData[channel]["channel"]["display_name"], streamData[channel]["viewers"], streamData[channel]["channel"]["game"], streamData[channel]["channel"]["status"])
				if (get_topic(channelObjects[channel]) is not None):
					if (hexchat.strip(newTopic) != hexchat.strip(get_topic(channelObjects[channel]))):
						set_topic(channelObjects[channel], newTopic)
				else:
					set_topic(channelObjects[channel], newTopic)
Exemplo n.º 4
0
def setup_channels(word, word_eol, user_data):
    # Callback for: server motd-received event
    # Unhook and /join channels
    hexchat.unhook(setup_channels)
    hexchat.prnt('FOOOOOOOOOOOOOOOOOO')
    x = hexchat.list_pluginpref()
    hexchat.prnt(x)
Exemplo n.º 5
0
def disable_standup(word, word_eol, userdata):
    global standup_hook
    if standup_hook is not None:
        hexchat.unhook(standup_hook)
        standup_hook = None
        print("standup pluging disabled")
    return hexchat.EAT_ALL
def on_unload(userdata):
    global hooks
    for hook in hooks:
        if hook is not None:
            hexchat.unhook(hook)
    del hooks[:]
    print("Send Multiple Channels unloaded")
Exemplo n.º 7
0
def on_unload(userdata):
	global hooks
	for hook in hooks:
		if hook is not None:
			hexchat.unhook(hook)
	del hooks[:]
	print("ChatBash unloaded")
Exemplo n.º 8
0
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
Exemplo n.º 9
0
def on_unload(userdata):
    global hooks
    for hook in hooks:
        if hook is not None:
            hexchat.unhook(hook)
    del hooks[:]
    print("ChatPipe unloaded")
Exemplo n.º 10
0
def links_cb(word, word_eol, userdata):
    if word[1] == "364":
        hexchat.command("FULLVERSION {}".format(word[3]))
    elif word[1] == "365":
        global hook, hookend
        hexchat.unhook(hook)
        hexchat.unhook(hookend)
Exemplo n.º 11
0
def base_commands(word, word_eol, userdata):
   if hexchat.get_info("network") != "Twitch":
    if word[1] == "help":
        say("Valid commands: help, currenttime, eat, time, uptime, douptime, version, mail")
    elif word[1] == "time":
        say("blargcat was started at " + datetime.strftime(start_time, '%Y-%m-%d %H:%M:%S'))
    elif word[1] == "currenttime":
        say("The current time for blargcat is " + datetime.strftime(datetime.now(), '%Y-%m-%d %H:%M:%S'))
    elif word[1] == "uptime":
        get_uptime(word)
    elif word[1] == "eat":
        eat()
    elif word[1] == "reload":
        reload_config()
        hexchat.unhook(notify_hook)
        hexchat.hook_timer(notif_timer_value, notify)
    # elif word[1] == ".tps":
    #    say("TPS:\0033 19.97")
    # elif word[1] == ".list":
    #    say("\00312Online (2/20): \0034[Admin] \00315blargcat\0031, \0039[Member] \00315FacePolice")
    elif word[1] == "version":
        say("blargcat is running \0039" + __module_name__ + "\0031 version\0039 " + __module_version__)
    elif word[1].startswith("mail"):
        mail(word)
    elif word[1] == "douptime":
        say(".uptime")
    elif word[1].startswith("raw "):
      global authed_user
      print(authed_user)
      print(word[0])
      if authed_user == hexchat.strip(word[0], len(word[0]), 3):
        raw(word[1].replace("raw ", ""))
      else:
        say("You are not authed!")
def checkStreams():
	global firstRun

	if (firstRun):
		hexchat.unhook(timerHook)
		hexchat.hook_timer(300000, checkStreams_cb)
		firstRun = False

	channels = hexchat.get_list('channels')
	realChannels = []

	for channel in channels:
		if (channel.server == 'tmi.twitch.tv' and channel.channel[0] == '#'):
			realChannels.append(channel.channel.strip('#'))

	for channel in realChannels:
		obj = loadJSON('https://api.twitch.tv/kraken/streams/' + channel)

		if (obj['stream'] == None and channel in liveChannels):
			liveChannels.remove(channel)
			format(channel.title() + ' is not live anymore.')
		elif (obj['stream'] != None and channel not in liveChannels):
			liveChannels.append(channel)
			format(channel.title() + ' is live!')
			format(obj['stream']['channel']['status'] + '(' + obj['stream']['game'] + ')')
		elif (obj['stream'] == None and channel not in liveChannels):
			format(channel.title() + ' is offline.')
Exemplo n.º 13
0
def remove_alias(name, quiet=False):
	hexchat.del_pluginpref('alias_' + name)
	if name in alias_hooks:
		hook = alias_hooks.get(name)
		hexchat.unhook(hook)
		del alias_hooks[name]
		return True
	return False
Exemplo n.º 14
0
def remove_alias(name, quiet=False):
    hexchat.del_pluginpref('alias_' + name)
    if name in alias_hooks:
        hook = alias_hooks.get(name)
        hexchat.unhook(hook)
        del alias_hooks[name]
        return True
    return False
Exemplo n.º 15
0
    def stop(self):
        """ Stop pasting lines in this message context. """
        if self.state == 'stop':
            raise HexPasteError('HexPaste: not pasting to: {}.'.format(self.context))

        hexchat.unhook(self.hook)
        self.hook = None
        self.state = 'stop'
Exemplo n.º 16
0
def defab_callback(word, word_eol, user_data):
    global fab_hook

    if fab_hook is not None:
        hexchat.unhook(fab_hook)
        fab_hook = None
        hexchat.prnt('Fabulous mode off')

    return hexchat.EAT_ALL
Exemplo n.º 17
0
def defab_callback(word, word_eol, user_data):
	global fab_hook
	
	if fab_hook is not None:
		hexchat.unhook(fab_hook)
		fab_hook = None
		hexchat.prnt('Fabulous mode off')
	
	return hexchat.EAT_ALL
Exemplo n.º 18
0
def time_cb(txt):
    global week
    global hook
    channel = hexchat.find_context(channel='#xshellz')
    channel.command('say {1} {0}'.format(username,txt))
    update()
    if hook:
        hexchat.unhook(hook)
    hook = hexchat.hook_timer((week*1000),time_cb,userdata='!keep')
Exemplo n.º 19
0
def _timeout_telegram_first(userdata):
	global timer_telegram_first
	try:
		telegram_bot_get_bot_info()
	except:
		if bDEBUG: print("** Telegram interface :: Can't get bot info | Error from script call to telegram_bot_get_bot_info()")
		log_print("** Telegram interface :: Can't get bot info | Error from script call to telegram_bot_get_bot_info()")
	hexchat.unhook(timer_telegram_first)
	timer_telegram_first = None
	return 1
Exemplo n.º 20
0
 def stop(self, word=[""], word_eol=[""], userdata=None):
     self.SendMessage(BOLD + COLORDEFAULT + 'Le jeu s\'arrête.')
     self.mode = 0
     try:
         hexchat.unhook(self.timerHook)
     except SystemError:
         hexchat.prnt('Unable to unhook the timer.')
     self.writeCooldownFile('cooldowns')
     self.writeScores()
     return hexchat.EAT_ALL
Exemplo n.º 21
0
def unload():
    """This function disconects all module functions"""
    # 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)
Exemplo n.º 22
0
	def stop(self, word = [""], word_eol = [""], userdata = None):
		self.SendMessage(BOLD + COLORDEFAULT + 'Le jeu s\'arrête.')
		self.mode = 0
		try:
			hexchat.unhook(self.timerHook)
		except SystemError:
			hexchat.prnt('Unable to unhook the timer.')
		self.writeCooldownFile('cooldowns')
		self.writeScores()
		return hexchat.EAT_ALL
Exemplo n.º 23
0
	def invited_callback(word, word_eol, user_data):
		invited_result = hexchat.EAT_NONE
		
		if word[0] == channel:
			hexchat.unhook(invited_hook)
			hexchat.unhook(denied_hook)
			invited_result = hexchat.EAT_HEXCHAT
			hexchat.command('join {0}'.format(channel))
		
		return invited_result
Exemplo n.º 24
0
def DelHook():
    global nibl_hook
    if os.path.exists(nibl_dir + "xdccfilter"):
        os.remove(nibl_dir + "xdccfilter")
    if nibl_hook is not None:
        hexchat.unhook(nibl_hook)
        nibl_hook = None
        hexchat.command("MENU -t0 ADD \"NIBL/XDCC Filter\" \"nxf on\" \"nxf off\"")
    print "NIBL XDCC Filter deactivated"
    return hexchat.EAT_ALL
Exemplo n.º 25
0
 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
Exemplo n.º 26
0
def DelHook():
    global nibl_hook
    if os.path.exists(nibl_dir + "xdccfilter"):
        os.remove(nibl_dir + "xdccfilter")
    if nibl_hook is not None:
        hexchat.unhook(nibl_hook)
        nibl_hook = None
        hexchat.command(
            "MENU -t0 ADD \"NIBL/XDCC Filter\" \"nxf on\" \"nxf off\"")
    print "NIBL XDCC Filter deactivated"
    return hexchat.EAT_ALL
Exemplo n.º 27
0
def numeric_cb(word, word_eol, userdata):
    line = word_eol[3][1:]
    if msgbox:
        helpop_line.append(line)
    else:
        print(line)
    if line == "*** End of HELPOP":
        hexchat.unhook(hook)
        if msgbox:
            hexchat.command("GUI MSGBOX {}".format("\n".join(map(sanitise_line, helpop_line))))
        helpop_line.clear()
    return hexchat.EAT_HEXCHAT
Exemplo n.º 28
0
def toggle_debug(*args):
    global debug_handler
    global DEBUG

    if not debug_handler:
        print_fc("enabling debug")
        DEBUG = True
        debug_handler = hexchat.hook_print("Key Press", debug_keypress_cb)
    else:
        print_fc("disabling debug")
        DEBUG = False
        hexchat.unhook(debug_handler)
        debug_handler = None
Exemplo n.º 29
0
def toggle_debug(*args):
    global debug_handler
    global DEBUG

    if not debug_handler:
        print_fc("enabling debug")
        DEBUG = True
        debug_handler = hexchat.hook_print("Key Press", debug_keypress_cb)
    else:
        print_fc("disabling debug")
        DEBUG = False
        hexchat.unhook(debug_handler)
        debug_handler = None
Exemplo n.º 30
0
	def notice_callback(word, word_eol, user_data):
		unban_result = hexchat.EAT_NONE
		nickname = hexchat.get_info('nick')
		
		if re.search(r'{0} has been unbanned from {1}\.'.format(nickname, channel), hexchat.strip(word[1])):
			hexchat.unhook(notice_hook)
			unban_result = hexchat.EAT_HEXCHAT
			hexchat.command('join {0}'.format(channel))
		
		elif word[1] == 'Permission denied.':
			hexchat.unhook(notice_hook)
		
		return unban_result
Exemplo n.º 31
0
	def getkey_callback(word, word_eol, user_data):
		key = ''
		
		matches = re.match('KEY {0} (.*)$'.format(channel), word[1]) or re.match('Channel \x02{0}\x02 key is: (.*)$'.format(channel), word[1])
		if matches:
			hexchat.unhook(getkey_hook)
			key = matches.group(1)
		
		elif word[1] == 'Access denied.' or word[1] == 'You are not authorized to perform this operation.':
			hexchat.unhook(getkey_hook)
		
		if key:
			hexchat.command('join {0} {1}'.format(channel, key))
Exemplo n.º 32
0
 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()
Exemplo n.º 33
0
 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()
Exemplo n.º 34
0
 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
Exemplo n.º 35
0
 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
Exemplo n.º 36
0
    def notice_callback(word, word_eol, user_data):
        unban_result = hexchat.EAT_NONE
        nickname = hexchat.get_info('nick')

        if re.search(
                r'{0} has been unbanned from {1}\.'.format(nickname, channel),
                hexchat.strip(word[1])):
            hexchat.unhook(notice_hook)
            unban_result = hexchat.EAT_HEXCHAT
            hexchat.command('join {0}'.format(channel))

        elif word[1] == 'Permission denied.':
            hexchat.unhook(notice_hook)

        return unban_result
Exemplo n.º 37
0
def _timeout_telegram_first(userdata):
    global timer_telegram_first
    try:
        telegram_bot_get_bot_info()
    except:
        if bDEBUG:
            print(
                "** Telegram interface :: Can't get bot info | Error from script call to telegram_bot_get_bot_info()"
            )
        log_print(
            "** Telegram interface :: Can't get bot info | Error from script call to telegram_bot_get_bot_info()"
        )
    hexchat.unhook(timer_telegram_first)
    timer_telegram_first = None
    return 1
Exemplo n.º 38
0
 def callback_and_unhook(words, words_eol, *args):
     o = bool(int(words_eol[1]))
     threading.Thread(target=callback, args=(o, )).start()
     {
         hexchat.unhook(handler)
         for handler in hexchat_callback_handlers[cmdname]
     }
Exemplo n.º 39
0
def on_notice(word, word_eol, userdata):
    global last_notice
    if word_eol[0] != last_notice:
        last_notice = word_eol[0]
        global timer_hook
        global block_time
        # If there is a timer currently running, replace it with a fresh one
        if timer_hook is not None:
            hexchat.unhook(timer_hook)
            timer_hook = hexchat.hook_timer(block_time, timer)
        else:
            timer_hook = hexchat.hook_timer(block_time, timer)
        return hexchat.EAT_NONE
    else:
        # Eat the event so other plugins/HexChat don't see it
        return hexchat.EAT_ALL
Exemplo n.º 40
0
    def getkey_callback(word, word_eol, user_data):
        key = ''

        matches = re.match(
            'KEY {0} (.*)$'.format(channel), word[1]) or re.match(
                'Channel \x02{0}\x02 key is: (.*)$'.format(channel), word[1])
        if matches:
            hexchat.unhook(getkey_hook)
            key = matches.group(1)

        elif word[1] == 'Access denied.' or word[
                1] == 'You are not authorized to perform this operation.':
            hexchat.unhook(getkey_hook)

        if key:
            hexchat.command('join {0} {1}'.format(channel, key))
Exemplo n.º 41
0
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
Exemplo n.º 42
0
def unload(userdata):
    "Runs when plugin is unloaded. Not exactly necessary, but..."
    hexchat.unhook("Channel Message")
    hexchat.unhook("Private Message")
    hexchat.unhook("Private Message to Dialog")
    hexchat.unhook(hook_gpg)
    hexchat.emit_print(
        "Channel Message", __module_name__, __module_name__ + " unloaded!"
    )
Exemplo n.º 43
0
def redirect_help(word, word_eol, userdata):
    if len(word) == 1:
        for i,val in enumerate(redirects):
            print "#{id}: \x0303{command}\x0f with regex \x0303{regex}\x0f (\x0304{network}\x0f/\x0304{channel}\x0f) => \x0305{target}\x0f".format(id=i, **val.serialize())
    if len(word) == 3 and word[1] == "delete":
        d=False
        for i,val in enumerate(redirects):
            if str(i) == word[2]:
                hexchat.unhook(redirects[i].handler)
                del(redirects[i])
                with open(CONFIG_FILE, 'w') as f:
                    json.dump({"redirects": [redir.serialize() for redir in redirects]}, f)
                print("Deleted #{id}".format(id=i))
                d=True
        if d is False:
            print("Could not find #{id}".format(id=i))
    return hexchat.EAT_ALL
Exemplo n.º 44
0
 def callback_and_unhook(words, words_eol, *args):
     o = words_eol[1]
     if o != "(paste here)":
         threading.Thread(target=callback, args=(o, )).start()
     {
         hexchat.unhook(handler)
         for handler in hexchat_callback_handlers[cmdname]
     }
Exemplo n.º 45
0
 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
Exemplo n.º 46
0
 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
Exemplo n.º 47
0
def endquietlist_cb(word, word_eol, usermask):
	global quiethook
	global endquiethook
	global quietlist
	matchlist = []

	hexchat.unhook(quiethook)
	quiethook = 0
	hexchat.unhook(endquiethook)
	endquiethook = 0

	if quietlist:
		matchlist = search_list(quietlist, usermask)
		quietlist = []

	print_result (usermask, matchlist, 'Quiet')

	return hexchat.EAT_HEXCHAT
Exemplo n.º 48
0
def endbanlist_cb(word, word_eol, usermask):
	global banhook
	global endbanhook
	global banlist
	matchlist = []

	hexchat.unhook(banhook)
	banhook = 0
	hexchat.unhook(endbanhook)
	endbanhook = 0

	if banlist:
		matchlist = search_list(banlist, usermask)
		banlist = []

	print_result (usermask, matchlist, 'Ban')

	return hexchat.EAT_HEXCHAT
Exemplo n.º 49
0
def toggle_autopaste(*args):
    global autopaste_handler
    words = args[0]
    bools = {True: ("1", "on", "true", "t"), False: ("0", "off", "false", "f")}
    try:
        requested = words[1].lower()
    except IndexError:
        requested = ""

    print_debug("toggle_autopaste requested", requested)
    if not autopaste_handler and requested not in bools[False]:
        print_fc("enabling autopaste")
        set_option("autopaste", "on")
        autopaste_handler = hexchat.hook_print("Key Press", keypress_cb)
    elif autopaste_handler and requested not in bools[True]:
        print_fc("disabling autopaste")
        set_option("autopaste", "off")
        hexchat.unhook(autopaste_handler)
        autopaste_handler = None
Exemplo n.º 50
0
def toggle_autopaste(*args):
    global autopaste_handler
    words = args[0]
    bools = {True: ("1", "on", "true", "t"), False: ("0", "off", "false", "f")}
    try:
        requested = words[1].lower()
    except IndexError:
        requested = ""

    print_debug("toggle_autopaste requested", requested)
    if not autopaste_handler and requested not in bools[False]:
        print_fc("enabling autopaste")
        set_option("autopaste", "on")
        autopaste_handler = hexchat.hook_print("Key Press", keypress_cb)
    elif autopaste_handler and requested not in bools[True]:
        print_fc("disabling autopaste")
        set_option("autopaste", "off")
        hexchat.unhook(autopaste_handler)
        autopaste_handler = None
Exemplo n.º 51
0
def checkStreams():
    global firstRun
    if (firstRun):
        hexchat.unhook(timerHook)
        hexchat.hook_timer(300000, checkStreams_cb)
        firstRun = False

    channels = hexchat.get_list("channels")
    realChannels = []
    for channel in channels:
        if (channel.server == "tmi.twitch.tv" and channel.channel[0] == '#'):
            realChannels.append(channel.channel.strip('#'))

    for channel in realChannels:
        obj = loadJSON('https://api.twitch.tv/kraken/streams/' + channel)
        if (obj["stream"] == None and channel in liveChannels):
            liveChannels.remove(channel)
            format(channel.title() + " is not live anymore.")
        elif (obj["stream"] != None and channel not in liveChannels):
            liveChannels.append(channel)
            format(channel.title() + " is live!")
def checkStreams():
	global firstRun
	if(firstRun):
		hexchat.unhook(timerHook)
		hexchat.hook_timer(300000, checkStreams_cb)
		firstRun = False

	channels = hexchat.get_list("channels")
	realChannels = []
	for channel in channels:
		if(channel.server == "tmi.twitch.tv" and channel.channel[0] == '#'):
			realChannels.append(channel.channel.strip('#'))
	
	for channel in realChannels:
		obj = loadJSON('https://api.twitch.tv/kraken/streams/' + channel)
		if (obj["stream"] == None and channel in liveChannels):
			liveChannels.remove(channel)
			format(channel.title() + " is not live anymore.")
		elif (obj["stream"] != None and channel not in liveChannels):
			liveChannels.append(channel)
			format(channel.title() + " is live!")
Exemplo n.º 53
0
def open_url(word, word_eol, userdata):
    global hooked
    network, channel = userdata
    if word[0] in ["65293", "65421", "65307"]:
        hooked = False
        hide_hints(network, channel)
        hexchat.unhook(hint_hook)
        # Escape
        if word[0] == "65307":
            return
        inputbox = hexchat.get_info("inputbox")
        hexchat.command("settext")
        try:
            hint = int(inputbox)
        except ValueError:
            pretty_print("Hint must be an integer!")
            return
        if hint <= len(uids):
            hexchat.command("URL %s" % uids[hint])
        else:
            pretty_print("Hint not found!")
Exemplo n.º 54
0
 def off(s,a,b,c):
     if a[1] == "fizz":
         hexchat.unhook(s.fizz)
         s.fizz = 0
     elif a[1] == "chan":
         hexchat.unhook(s.chan)
         s.chan = 0
     elif a[1] == "msg":
         hexchat.unhook(s.msg)
         s.msg = 0
     elif a[1] == "nim":
         hexchat.unhook(s.nim)
         s.nim = 0
     else:
         hexchat.prnt("args must be valid")
     return hexchat.EAT_HEXCHAT
Exemplo n.º 55
0
def show_hints(word, word_eol, userdata):
    global halt, hint_hook, hooked
    if not word == ['88', '21', '\x18', '1']:
        return
    if hooked is True:
        hexchat.unhook(hint_hook)
        hooked = False
    network = hexchat.get_info("network")
    channel = hexchat.get_info("channel")
    if network not in networks or channel not in networks[network]:
        pretty_print("Nothing to print.")
        return
    hexchat.command("clear")
    uids.clear()
    halt = True
    hooked = True
    for msg in networks[network][channel]:
        data = urlify(msg['event'], msg['data'], network, channel)
        hexchat.emit_print(msg['event'], *data, time=msg['time'])
    pretty_print("Hint to follow?")
    hint_hook = hexchat.hook_print("Key Press", open_url, (network, channel))
    halt = False
    return hexchat.EAT_ALL