Hello!
I'm making a quiz app - guess the bird.
On command in the chat, Nightbot sends a request to the VPS server, where the app node.is should send a link to the picture of the bird to the chat.
And here's the problem with printing a message to the chat.
I'm trying to get authorization for the application and send messages to the chat on YouTube..
//api.nightbot.tv/oauth2/authorize?response_type=code&client_id=689ce560727f86682b3179&redirect_uri=http://localhost:4000&scope=commands%20channel_send%20channel
I get the code but in the end the scope = me
{"access_token":"*****a0b5f8431a84340a","token_type":"bearer","expires_in":2592000,"refresh_token":"ec10bb8619e31e983a79e913","scope":"me"}
And in the end I can't type a message in the chat through the application.
Where to look, please tell me.
I only hope for your help. GPT doesn't know anything.
function sendMessageToChat(message) {const nightbotWebhookUrl = 'https://api.nightbot.tv/1/channel/send';// Отправляем сообщение в чат с помощью вебхукаaxios.post(nightbotWebhookUrl, null, {params: {message: message // Отправляем сообщение как параметр запроса},headers: {'Authorization': `Bearer X`, // Подставь свой токен'Content-Type': 'application/x-www-form-urlencoded' // Указываем тип контента}}).then(response => {console.log('Сообщение успешно отправлено в чат Nightbot');}).catch(error => {console.error('Ошибка при отправке сообщения в чат:', error.response ? error.response.data : error.message);});}