Node.js 存在Twitch.TV重复消息问题的节点irc

Node.js 存在Twitch.TV重复消息问题的节点irc,node.js,bots,twitch,Node.js,Bots,Twitch,我的节点irc机器人有时会重复它在聊天中说的话。有时它工作得很好;其他时候它会重复。我已经浏览了我的所有代码,我找不到任何正在进行的递归 连接功能(与我的听众) 机器人创建(在连接之前调用) 机器人发送消息 //connects the bot to the channel this.connectToChannel = function(callback) { console.log("Connection"); botInstance.connect(); botIn

我的节点irc机器人有时会重复它在聊天中说的话。有时它工作得很好;其他时候它会重复。我已经浏览了我的所有代码,我找不到任何正在进行的递归

连接功能(与我的听众)

机器人创建(在连接之前调用)

机器人发送消息

//connects the bot to the channel
this.connectToChannel = function(callback) {
    console.log("Connection");
    botInstance.connect();
    botInstance.join(currentChannel, function(){
        botInstance.say(currentChannel, initalConnectionMessage);
        console.log("Joined");
        callback();
    });
    botInstance.addListener("message", function(nick, to, text, message) {
        if (text == lastText){
            return; // you can i've tried to avoid this issue
        }

        bannedWords.forEach(function(item,index){
            if (text.includes(item)){
                parent.sendMessage(nick + " > You're not allowed to use that type of language.");
                parent.sendMessage("/timeout " + nick + " 10");
            }
        });

        commands.forEach(function(item, index){
            var splitData = text.split(' ');

            if (splitData[0] == item.getExecutor()) {
                //running this command

                var response = item.getResponse();
                response = response.replace("%user%", nick);
                response = response.replace("%bot_username%", config.botName);

                parent.sendMessage(response);
            }
        });
    });
}
this.sendMessage = function(msg){
if(botInstance != null) {
    botInstance.say(currentChannel, msg);
    lastMessage = msg;
}

出于兴趣,你为什么不在twitch聊天机器人上使用tmi.js?@MattC Well node irc是我遇到的第一个。一般来说,通用IRC客户端工作得相当好。如果需要,我也可以让这个机器人在其他地方工作。如果我的重复消息问题继续存在,我会调查tmi.js。出于兴趣,你为什么不在twitch聊天机器人上使用tmi.js?@MattC Well node irc是我遇到的第一个。一般来说,通用IRC客户端工作得相当好。如果需要,我也可以让这个机器人在其他地方工作。如果我的重复消息问题继续存在,我将查看tmi.js。
this.sendMessage = function(msg){
if(botInstance != null) {
    botInstance.say(currentChannel, msg);
    lastMessage = msg;
}