4.6.7 • Published 3 years ago

twitch-auth-tmi v4.6.7

Weekly downloads
126
License
MIT
Repository
github
Last release
3 years ago

Twitch.js - Authentication for TMI.js

Use tmi.js with the added benefits of twitch-auth's automatic token handling.

Installation

yarn add twitch-auth twitch-auth-tmi

or using npm:

npm install twitch-auth twitch-auth-tmi

How to use

This package is generally used like tmi.js is normally, with just a single minor change.

It completely ignores the identity option, and instead takes an authProvider option which takes an AuthProvider instance that can be used for other twitch packages as well.

This also offers the additional benefit of being able to refresh tokens internally using a refreshable AuthProvider.

Example

Taken from the tmi.js README and adapted for this package:

const tmi = require('twitch-auth-tmi');
const { StaticAuthProvider } = require('twitch-auth');
const authProvider = new StaticAuthProvider('my-client-id', 'my-bot-token');
const client = new tmi.Client({
	options: { debug: true, messagesLogLevel: 'info' },
	connection: {
		reconnect: true,
		secure: true
	},
	authProvider: authProvider,
	channels: ['my-channel']
});
client.connect().catch(console.error);
client.on('message', (channel, tags, message, self) => {
	if (self) return;
	if (message.toLowerCase() === '!hello') {
		client.say(channel, `@${tags.username}, heya!`);
	}
});

If you're getting stuck...

You can join the Discord server for support.

4.6.7

3 years ago

4.6.6

3 years ago

4.6.5

3 years ago

4.6.4

3 years ago

4.6.3

3 years ago

4.6.2

3 years ago

4.6.1

3 years ago

4.6.0

3 years ago

4.6.0-pre.5

3 years ago

4.6.0-pre.4

3 years ago

4.6.0-pre.3

3 years ago

4.6.0-pre.2

3 years ago

4.6.0-pre.1

3 years ago

4.6.0-pre.0

3 years ago

4.5.5

3 years ago

4.5.4

3 years ago

4.5.3

3 years ago

4.5.2

3 years ago

5.0.0-pre.2

3 years ago

4.5.1

3 years ago

4.5.0

3 years ago

4.4.13

3 years ago

5.0.0-pre.1

3 years ago

4.4.12

3 years ago

4.4.11

3 years ago

4.4.10

3 years ago

4.4.9

3 years ago

5.0.0-pre.0

3 years ago

4.4.8

3 years ago

4.4.7

3 years ago

4.4.6

3 years ago

4.4.5

3 years ago

4.4.4

3 years ago

4.4.3

3 years ago

4.4.2

3 years ago

4.4.1

3 years ago

4.4.0

3 years ago

4.4.0-pre.4

3 years ago

4.4.0-pre.3

3 years ago