Skip to content

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)

License

Notifications You must be signed in to change notification settings

pierregoutheraud/tmi.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tmi.js - v2

npm GitHub issues

Usage

import * as tmi from 'tmi.js';

const client = new tmi.Client({
	identity: {
		name: 'my-bot-name',
		auth: 'oauth:my-bot-auth'
	}
});

client.connect();

client.on('connected', async () => {
	console.log('Connected');
	try {
		await client.join('alca');
	} catch(error) {
		console.error(error);
	}
});

client.on('join', ({ channel, user }) => {
	if(user.isClientUser) {
		// "Joined #alca"
		console.log(`Joined ${channel.name}`);
	}
});

client.on('message', ({ channel, message, user, reply, isClientUser }) => {
	// "[#alca] Alca: !hello"
	console.log(`[${channel.name}] ${user.displayName}: ${message}`);
	if(isClientUser) {
		return;
	}
	if(message.toLowerCase() === '!hello') {
		// "@alca, heya!""
		reply(`@${user.login}, heya!`);
	}
});

Contribute

See the guidelines.

git clone -b v2 --single-branch [email protected]:tmijs/tmi.js.git
npm install
npm run build
npm run test

About

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%