Example #1
0
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
Example #2
0
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
Example #3
0
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
Example #4
0
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
Example #5
0
print('testing')

print('declearing function')


def my_func(type=True, str='noo'):
    if type == 1:
        return 'true' + str
    else:
        return 'false' + str


print(my_func(str='yess', type=False))

common.me('shan')

mine('shadman')

#raise ValueError('number must be non-negative')

try:
    import shan
except ImportError:
    #print('error')
    chardet = None
    #raise ValueError('Test')

if chardet:
    print(chardet)
else: