Top.Mail.Ru
Ответы

Проблема с ботом твич javascript!!!!

Enter the bot name and message: [19:44] info: Connecting to irc-ws.chat.twitch.tv on port 443..
[19:44] info: Sending authentication to server..
[19:44] info: Connecting to irc-ws.chat.twitch.tv on port 443..
[19:44] info: Sending authentication to server..
[19:44] error: Invalid NICK.
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Invalid NICK.".] {
code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v20.4.0
Press any key to continue...

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
 const fs = require('fs'); 
const tmi = require('tmi.js'); 
const readline = require('readline'); 
 
 
// Чтение данных из файла  
const data = fs.readFileSync('путь tokens.txt', 'utf8'); 
const lines = data.split('\n'); 
 
// Создание клиентов Twitch  
const clients = lines.map(line => { 
    const [username, password] = line.split(':'); 
 
    const config = { 
        options: { debug: true }, 
        connection: { reconnect: true }, 
        identity: { username, password }, 
        channels: ['канал'] 
    }; 
 
    return new tmi.Client(config); 
}); 
 
// Подключение к серверу Twitch  
clients.forEach(client => { 
    client.connect(); 
 
    client.on('connected', (address, port) => { 
        console.log(`Connected to ${address}:${port}`); 
    }); 
}); 
 
// Обработка команд отправки сообщений  
function sendMessage(botName, channel, message) { 
    const client = clients.find(c => c.getUsername() === botName); 
 
    if (client) { 
        client.say(channel, message); 
    } else { 
        console.log(`Bot ${botName} not found`); 
    } 
} 
 
// Чтение ввода с консоли  
const rl = readline.createInterface({ 
    input: process.stdin, 
    output: process.stdout 
}); 
 
// Ввод сообщения и отправка в чат  
rl.setPrompt('Enter the bot name and message: '); 
rl.prompt(); 
 
rl.on('line', (line) => { 
    const [botName, ...messageParts] = line.split(' '); 
    const message = messageParts.join(' '); 
 
    sendMessage(botName, 'канал', message); 
    rl.prompt(); 
}).on('close', () => { 
    process.exit(0); 
}); 
По дате
По Рейтингу
Аватар пользователя

Ты уже все засрал тут своим ботом, надоел

Аватар пользователя
Искусственный Интеллект

Invalid NICK у тебя