tmijs / tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.54k stars 216 forks source link

add Hype Train event and channel point event PLEASEEE #526

Closed FabienBounoir closed 1 year ago

AlcaDesign commented 1 year ago

There are no hype train events sent to the chat interface that tmi.js uses. The only channel point events that are available are ones that require user input. That's highlighted message, sub skip messages, and custom rewards that are set to require user input. These are all doubled through the relevant action, chat, and message events as well as the redeem event. You can get a custom reward's ID (UUID pattern) through the Helix API or just by testing it in the chat and logging unknown reward IDs.

client.on('redeem', (channel, username, rewardType, tags, message) => {
    switch(rewardType) {
        // Message that appears "highlighted" in the chat.
        case 'highlighted-message': break;
        // Message that skips the subscriber-only mode
        case 'skip-subs-mode-message': break;
        // Custom reward ID
        case '27c8e486-a386-40cc-9a4b-dbb5cf01e439': break;
        default: {
          console.log('Unknown reward ID', rewardType);
          break;
        }
    }
});