Не работает чат bot twitch java script !!!!!
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
const tmi = require('tmi.js');
// Define configuration options
const opts = {
identity: {
username: '<edward3706>',
password: '<oauth:2urni6d8l1fq4spw5natxfdgiqymjv>'
},
channels: [
'<paulinol1>'
]
};
// Create a client with our options
const client = new tmi.client(opts);
// Register our event handlers (defined below)
client.on('message', onMessageHandler);
client.on('connected', onConnectedHandler);
// Connect to Twitch:
client.connect();
// Called every time a message comes in
function onMessageHandler(target, context, msg, self) {
if (self) { return; } // Ignore messages from the bot
// Remove whitespace from chat message
const commandName = msg.trim();
// If the command is known, let's execute it
if (commandName === '!dice') {
const num = rollDice();
client.say(target, `You rolled a ${num}`);
console.log(`* Executed ${commandName} command`);
} else {
console.log(`* Unknown command ${commandName}`);
}
}
// Function called when the "dice" command is issued
function rollDice() {
const sides = 6;
return Math.floor(Math.random() * sides) + 1;
}
// Called every time the bot connects to Twitch chat
function onConnectedHandler(addr, port) {
console.log(`* Connected to ${addr}:${port}`);
}
Все данные верны но выдаёт ошибку
1234567891011
[17:46] error: Login authentication failed
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 "Login authentication failed".] {
code: 'ERR_UNHANDLED_REJECTION'
}
Node.js v20.4.0
Press any key to continue...
Только авторизированные пользователи могут оставлять свои ответы
Дата
Популярность
у тебя user name с <>
Гений, у тебя юзернейм и токен с <>. Ты совсем дурак?
сам решай