Example #1
0
def react(t, irc):
    command, message = common.command(common.type(t))
    args = message['args']
    sender = common.senderFormat(message['from'], "nick")
    if command == None:
        return False
    if command.lower() != "weather":
        return False
    if len(args) == 0:
        location = getSavedData(sender)
    else:
        location = " ".join(args)
        putSavedData(sender, location)
    if location == False:
        if message["to"].split("!")[0] != common.conf.read()["nick"]:
            common.say(
                message['to'],
                "Sorry, I don't know where you live. Try \"{0}weather <location>\""
                .format(common.conf.read()['commands']['commandPrefix']), irc)
        else:
            common.say(
                common.senderFormat(message["from"], "nick"),
                "Sorry, I don't know where you live. Try \"{0}weather <location>\""
                .format(common.conf.read()['commands']['commandPrefix']), irc)
    else:
        if message["to"].split("!")[0] != common.conf.read()["nick"]:
            common.say(message['to'], stringFromLocation(location), irc)
        else:
            common.say(common.senderFormat(message["from"], "nick"),
                       stringFromLocation(location), irc)
Example #2
0
def react(input, irc):
    command, message = common.command(common.type(input))  # dict
    if command == None:
        return
    elif command == "":
        textReact(message, irc)
    elif command == "sr" or command == "simpleresponse":
        srEdit(message, irc)
    else:
        commandReact(command, message, irc)
    print "stopping \"simpleResponse\""
Example #3
0
def react(input,irc):
	command,message = common.command(common.type(input)) # dict
	if command == None:
		return
	elif command == "":
		textReact(message,irc)
	elif command == "sr" or command == "simpleresponse":
		srEdit(message,irc)
	else:
		commandReact(command,message,irc)
	print "stopping \"simpleResponse\""
Example #4
0
def react(t,irc):
    command,message = common.command(common.type(t))
    args = message['args']
    sender = common.senderFormat(message['from'],"nick")
    if command == None:
        return False
    if command.lower() != "weather":
        return False
    if len(args) == 0:
        location = getSavedData(sender)
    else:
        location = " ".join(args)
        putSavedData(sender,location)
    if location == False:
        if message["to"].split("!")[0] != common.conf.read()["nick"]:
            common.say(message['to'],"Sorry, I don't know where you live. Try \"{0}weather <location>\"".format(common.conf.read()['commands']['commandPrefix'])  ,  irc)
        else:
            common.say(common.senderFormat(message["from"],"nick"),"Sorry, I don't know where you live. Try \"{0}weather <location>\"".format(common.conf.read()['commands']['commandPrefix']),irc)
    else:
        if message["to"].split("!")[0] != common.conf.read()["nick"]:
            common.say(message['to'],stringFromLocation(location),irc)
        else:
            common.say(common.senderFormat(message["from"],"nick"),stringFromLocation(location),irc)