How to use the twitch-js.Chat function in twitch-js

To help you get started, we’ve selected a few twitch-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twitch-js / twitch-js / examples / node.js View on Github external
// Instantiate clients.
const { api, chat } = new TwitchJs({ token, username });

// Get featured streams.
api.get('streams/featured', { version: 'kraken' }).then(response => {
  console.log(response);
  // Do stuff ...
});

const handleMessage = message => {
  console.log(message);
  // Do other stuff ...
};

// Listen for all events.
chat.on(TwitchJs.Chat.Events.ALL, handleMessage);

// Connect ...
chat.connect().then(() => {
  // ... and then join the channel.
  chat.join(channel);
});

twitch-js

Javascript library for the Twitch Messaging Interface.

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis