def privateCommands(sock, line, botConfig): #Check for the password if (len(line) >= 5): if (len(line) >= 6): if (checkPassword(line[4], botConfig)): if (line[3] == ":&join"): botCore.joinChannels(sock, [line[5]]) elif (line[3] == ":&leave"): botCore.leaveChannels(sock, [line[5]]) elif (line[3] == ":&quit"): sock.send("QUIT :" + botConfig.get('Bot', 'quit_message') + "\r\n") sys.exit() elif (line[3] == ":&say"): lineToSend = "" for x in range(6, len(line)): if (x == 6): lineToSend += line[x] else: lineToSend = lineToSend + " " + line[x] botCore.sendLine(sock, line[5], lineToSend) elif (line[3] == ":&act"): lineToSend = "" for x in range(6, len(line)): if (x == 6): lineToSend += line[x] else: lineToSend = lineToSend + " " + line[x] botCore.sendAction(sock, line[5], lineToSend) else: botCore.sendLine(sock, getUsername(line), "That password is INCORRECT.") else: botCore.sendLine(sock, getUsername(line), "You did not specify any parameters. The correct format for the private bot commands is /msg " + botConfig.get('Bot', 'bot_nickname') + " &command password parameter, please try AGAIN.") else: botCore.sendLine(sock, getUsername(line), "You did not specify a PASSWORD. The correct format for the private bot commands is /msg " + botConfig.get('Bot', 'bot_nickname') + " &command password parameter, please try AGAIN.")
for line in readBuffer: #Do some formatting line = botCore.formatLine(line) #Output the line to the console if not empty if not (line == []): botCore.consoleOutputLine(sock, line) if (len(line) >= 1): #Handler for NickServ identification and ajoining channels for x in range(0, len(line)): if (line[x] == "/MOTD"): botCore.sendLine(sock, "NickServ", "IDENTIFY " + botConfig.get('Bot', 'bot_nickserv_password')) time.sleep(1) botCore.joinChannels(sock, string.split(botConfig.get('Bot', 'ajoin_channels'), " ")) #Ping response if (line[0] == "PING"): sock.send("PONG %s\r\n" % line[1]) if (len(line) >= 4): #Version response if (line[3] == ":VERSION"): botCore.sendNotice(sock, botStandard.getUsername(line), ("VERSION " + botConfig.get('Bot', 'version_text') + "")) #Command processing (public and private), looking for & command delimiter if (len(list(line[3])) >= 2): if ((list(line[3]))[1] == "&"): #Public command processing caughtPublic = botStandard.publicCommands(sock, line)