예제 #1
0
def handleChatCommand(msg):
	# Try to split message
	args = msg.split(' ',1)
	# Check if the format is correct and is not empty
	if len(args) != 2 or not args[0] or not args[1]:
		return
	# Split correctly the message
	t = args[0].lower()
	if t == 'private' or t == 'note':
		# then check message is not empty
		argsExtra = args[1].split(' ',1)
		if len(argsExtra) != 2 or not argsExtra[0] or not argsExtra[1]:
			return
		args.pop(1)
		args += argsExtra
	# Check message type
	sent = False
	if t == "all":
		sent = phBotChat.All(args[1])
	elif t == "private":
		sent = phBotChat.Private(args[1],args[2])
	elif t == "party":
		sent = phBotChat.Party(args[1])
	elif t == "guild":
		sent = phBotChat.Guild(args[1])
	elif t == "union":
		sent = phBotChat.Union(args[1])
	elif t == "note":
		sent = phBotChat.Note(args[1],args[2])
	elif t == "stall":
		sent = phBotChat.Stall(args[1])
	elif t == "global":
		sent = phBotChat.Global(args[1])
	if sent:
		log('Plugin: Message "'+t+'" sent successfully!')
예제 #2
0
def sendChatCommand(message):
	try:
		# Delete CHAT word
		message = message[4:].strip()
		# Parse type
		t = message.split(' ',1)
		# Check arguments length and empty message
		if len(t) == 2 and len(t[1]) > 0:
			success = False
			type = t[0].lower()
			if type == "all":
				success = phBotChat.All(t[1])
			elif type == "private":
				t = t[1].split(' ',1)
				success = phBotChat.Private(t[0],t[1])
			elif type == "party":
				success = phBotChat.Party(t[1])
			elif type == "guild":
				success = phBotChat.Guild(t[1])
			elif type == "union":
				success = phBotChat.Union(t[1])
			elif type == "note":
				t = t[1].split(' ',1)
				success = phBotChat.Private(t[0],t[1])
			elif type == "stall":
				success = phBotChat.Stall(t[1])
			if success:
				log("Plugin: Message sent successfully")
	except:
		log('Plugin: Incorrect structure to send message')
예제 #3
0
def chat(args):
	args = FixEscapeComma(args)
	# Avoid wrong structure and empty stuffs
	if len(args) < 3 or not args[1] or not args[2]:
		return
	# Check message type
	sent = False
	t = args[1].lower()
	if t == "all":
		sent = phBotChat.All(args[2])
	elif t == "private":
		sent = phBotChat.Private(args[2],args[3])
	elif t == "party":
		sent = phBotChat.Party(args[2])
	elif t == "guild":
		sent = phBotChat.Guild(args[2])
	elif t == "union":
		sent = phBotChat.Union(args[2])
	elif t == "note":
		sent = phBotChat.Note(args[2],args[3])
	elif t == "stall":
		sent = phBotChat.Stall(args[2])
	elif t == "global":
		sent = phBotChat.Global(args[2])
	if sent:
		log('Plugin: Message "'+t+'" sent successfully!')
예제 #4
0
def parseChatCommand(msg):
	try:
		# Remove the command word
		args = msg.split(' ',1)
		# Check arguments length and avoid empty message
		if len(args) == 2 and args[1]:
			sent = False
			t = args[0].lower()
			# Check msg type and send it
			if t == "all":
				sent = phBotChat.All(args[1])
			elif t == "private":
				args = args[1].split(' ',1)
				# Check if the format is correct
				if len(args) == 2 and args[1]:
					sent = phBotChat.Private(args[0],args[1])
			elif t == "party":
				sent = phBotChat.Party(args[1])
			elif t == "guild":
				sent = phBotChat.Guild(args[1])
			elif t == "union":
				sent = phBotChat.Union(args[1])
			elif t == "note":
				t = args[1].split(' ',1)
				sent = phBotChat.Private(t[0],args[1])
			elif t == "stall":
				sent = phBotChat.Stall(args[1])
			elif t == "global":
				sent = phBotChat.Global(args[1])
			# Check if has been sent
			if sent:
				log("Plugin: "+t.title()+" message has been sent successfully")
	except:
		log('Plugin: Incorrect structure to send message')
예제 #5
0
def chat(args):
    # check arguments length and empty message
    if (len(args) >= 3 and len(args[2]) > 0):
        success = False
        type = args[1].lower()
        if type == "all":
            success = phBotChat.All(args[2])
        elif type == "private":
            success = phBotChat.Private(args[2], args[3])
        elif type == "party":
            success = phBotChat.Party(args[2])
        elif type == "guild":
            success = phBotChat.Guild(args[2])
        elif type == "union":
            success = phBotChat.Union(args[2])
        elif type == "note":
            success = phBotChat.Note(args[2], args[3])
        elif type == "stall":
            success = phBotChat.Stall(args[2])
        if success:
            log("Plugin: Message sent successfully (" + pName + ")")