Created
January 4, 2016 18:40
-
-
Save Aareon/23af95a8d88fc62e14ec to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python2.7 | |
""" | |
"join <#channel>", "part <#channel>"; | |
Ex: ".join #example", ".part #example" | |
Joins or parts from given channel. | |
""" | |
import urllib2, json, os | |
from parse import parse_json | |
from util.hook import * | |
@hook(cmds=['join','part']) | |
def connect(code,trigger): | |
command = trigger.split(' ')[0] | |
command_param = trigger.split(' ')[1] | |
if trigger.nick == "Aareon": | |
if "join" in trigger: | |
code.reply("Attempting to join: "+command_param) | |
code.join(command_param) | |
elif "part" in trigger: | |
try: | |
code.reply("Attempting to part: "+command_param) | |
code.part(command_param) | |
except IndexError: | |
return() | |
else: | |
return() | |
@hook(cmds=['shutdown']) | |
def shutdown(code,trigger): | |
if trigger.nick == "Aareon": | |
code.say("Thou shalt not leave...") | |
os._exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment