Skip to content

Sinon-Host/Aquaris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

A new lib for interfacing with twitch api and chat servers

Installation

Node.js 8.0.0 or newer is required.

npm install github:twitch-js/twitch.js --save

Example API

const config = { 'Client-ID': 'CLIENT_ID' };
const twitch = require('twitch.js');
const client = new twitch(config);

console.log(client.api);

(async () => {
    let res;

    try {
        res = await client.api.getUsers(['rosiecode']);
    } catch (error) {
        console.error(error);
    }

    console.log(`the user-id for ${res.users[0].display_name} is: ${res.users[0]._id}`);
})();

Example Chat

const twitch = require('./../index');
const config = { username: '<USERNAME>', oauth: 'oauth:<AUTH_TOKEN>' };
const client = new twitch(config);

client.on('message', (message) => { console.log(`${message.author} : ${message.content}`); });

client.on('disconnected', () => { console.log('[INFO]', 'DISCONNECTED FROM WS'); });
client.on('debug', (debug) => { console.log(`[DEBUG] ${debug}`); });

client.on('JOIN', ({ channel, user }) => { console.log(channel, user); });
client.on('PART', ({ channel, user }) => { console.log(channel, user); });

client.on('ready', () => {
    console.log('ready!');
    client.join('rosiecode'); // Join a channel
});

client.connect();

Contributing

have an issue? check current issues before reporting

Documentation

About

lib for interfacing with the twitch API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published