Answer the question
In order to leave comments, you need to log in
How to use JS to find out if a twitch account is followed?
There is a JS bot using TMI.js to work with twitch. I couldn’t find information about followers in the Twitch API documentation or in the TMI.js API documentation, but it’s very interesting, because other bots (Streamelements, for example) somehow find out about new followers. TMI.js has everything in the EVENTS section, except for information about new followers.
When a person writes to a chat, only this information is known about him:
{
'badge-info': null,
badges: { broadcaster: '1' },
'client-nonce': 'скрыл_на_всякий_случай',
color: '#FF4500',
'display-name': 'JOURLOY',
emotes: null,
flags: null,
id: 'скрыл_на_всякий_случай',
mod: false,
'room-id': 'скрыл_на_всякий_случай',
subscriber: false,
'tmi-sent-ts': 'скрыл_на_всякий_случай',
turbo: false,
'user-id': 'скрыл_на_всякий_случай',
'user-type': null,
'emotes-raw': null,
'badge-info-raw': null,
'badges-raw': 'broadcaster/1',
username: 'jourloy',
'message-type': 'chat'
}
Answer the question
In order to leave comments, you need to log in
Twitch now has webhooks, there is also an event with followers. Link to Documentation
let param1 = [];
let param2 = [];
setInterval(() => {
если первый параметр пустой, то записываем текущих подписчиков в два параметра
иначе
записываем текущих подписчиков в первый параметр
сравниваем два массива, если есть разница в большую сторону - находим подписавшегося
реагируем в чате на подписку
записываем текущих подписчиков во второй параметр
}, 500);
subscriber: false,
Most likely it is whether this person is a subscriber. In this case, no.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question