Created
March 17, 2013 15:31
-
-
Save ameliaikeda/5182048 to your computer and use it in GitHub Desktop.
Hexchat highlights script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hiroto's HL script. | |
__module_name__ = "PyHighlights" | |
__module_version__ = "v0.1" | |
__module_description__ = "Script to shove highlights into another window." | |
import urllib2 | |
import urllib | |
import xchat | |
context = xchat.get_context() | |
xchat.command("QUERY highlights") | |
context.set() | |
def print_highlight(context, channel, nick, message): | |
x = xchat.find_context(channel = "highlights") | |
x.emit_print("Private Message to Dialog", nick, "({0}): {1}".format(channel, message)) | |
context.set() | |
global _apikey | |
events = { | |
"apikey" : "key-goes-here", | |
"event" : u"Highlight from {0} in {1}".format(nick, channel), | |
"description" : message, | |
"application" : "IRC Highlights" | |
} | |
req = urllib2.Request("https://www.notifymyandroid.com/publicapi/notify", | |
urllib.urlencode(events)) | |
urllib2.urlopen(req) # can't be bothered to read response | |
return xchat.EAT_NONE | |
def main(word, word_eol, userdata): | |
context = xchat.get_context() | |
channel = context.get_info("channel") | |
nick = word[0] | |
message = word[1] | |
print_highlight(context, channel, nick, message) | |
return xchat.EAT_NONE | |
def unloaded(userdata): | |
print "unloaded highlights" | |
return xchat.EAT_NONE | |
xchat.hook_print("Channel Msg Hilight", main) | |
xchat.hook_unload(unloaded) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment