def commandReact(command, message, irc): arg = {} for i in range(0, len(message["args"])): arg.update({"arg" + str(i + 1): message["args"][i]}) if len(message["args"]) < 10: for i in range(len(message["args"]), 10): arg.update({"arg" + str(i + 1): ""}) for name in commands: c = commands[name] if c["reactTo"] == "sender": reactTo = common.senderFormat(message["from"], "nick") elif c["reactTo"] == "channel": if message["to"].split("!")[0] != common.conf.read()["nick"]: reactTo = message["to"] else: reactTo = common.senderFormat(message["from"], "nick") if command == name and c["reactType"] == "say": common.say(reactTo, common.substitute(c["reactText"], message, arg), irc) return True elif command == name and c["reactType"] == "me": common.me(reactTo, common.substitute(c["reactText"], message, arg), irc) return True return False
def textReact(message, irc): try: for c in texts: if c["reactTo"] == "sender": reactTo = common.senderFormat(message["from"], "nick") elif c["reactTo"] == "channel": if ommon.senderFormat(message["to"], "nick") != common.conf.read()["nick"]: reactTo = message["to"] else: reactTo = common.senderFormat(message["from"], "nick") if c["matchType"] == "equals" and message["message"].lower( ) == common.substitute(c["matchText"].lower(), message): if c["reactType"] == "say": common.say(reactTo, common.substitute(c["reactText"], message), irc) return True elif c["reactType"] == "me": common.me(reactTo, common.substitute(c["reactText"], message), irc) return True elif c["matchType"] == "contains" and message["message"].lower( ).find(common.substitute(c["matchText"].lower(), message)) != -1: if c["reactType"] == "say": common.say(reactTo, common.substitute(c["reactText"], message), irc) return True elif c["reactType"] == "me": common.me(reactTo, common.substitute(c["reactText"], message), irc) return True return False except: pass
def textReact(message,irc): try: for c in texts: if c["reactTo"] == "sender": reactTo = common.senderFormat(message["from"],"nick") elif c["reactTo"] == "channel": if ommon.senderFormat(message["to"],"nick") != common.conf.read()["nick"]: reactTo = message["to"] else: reactTo = common.senderFormat(message["from"],"nick") if c["matchType"] == "equals" and message["message"].lower() == common.substitute(c["matchText"].lower(),message): if c["reactType"] == "say": common.say(reactTo,common.substitute(c["reactText"],message),irc) return True elif c["reactType"] == "me": common.me(reactTo,common.substitute(c["reactText"],message),irc) return True elif c["matchType"] == "contains" and message["message"].lower().find(common.substitute(c["matchText"].lower(),message)) != -1: if c["reactType"] == "say": common.say(reactTo,common.substitute(c["reactText"],message),irc) return True elif c["reactType"] == "me": common.me(reactTo,common.substitute(c["reactText"],message),irc) return True return False except: pass
def commandReact(command,message,irc): arg = {} for i in range(0,len(message["args"])): arg.update({"arg"+str(i+1):message["args"][i]}) if len(message["args"]) < 10: for i in range(len(message["args"]),10): arg.update({"arg"+str(i+1):""}) for name in commands: c = commands[name] if c["reactTo"] == "sender": reactTo = common.senderFormat(message["from"],"nick") elif c["reactTo"] == "channel": if message["to"].split("!")[0] != common.conf.read()["nick"]: reactTo = message["to"] else: reactTo = common.senderFormat(message["from"],"nick") if command == name and c["reactType"] == "say": common.say(reactTo,common.substitute(c["reactText"],message,arg),irc) return True elif command == name and c["reactType"] == "me": common.me(reactTo,common.substitute(c["reactText"],message,arg),irc) return True return False