0.3.1 • Published 7 years ago

twitch-stream v0.3.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

twitch-stream :boom:

Stream Twitch chat in node js.

npm install --save twitch-stream
const twitchStream = require( 'twitch-stream' );

twitchStream.connect({
	user : 'username',
	pass : 'oauth:abc123',
	channel : 
	[
		'#user1',
		'#user2'
	],
	data : function( msg )
	{
		console.log( msg );
	},
	error : function( err )
	{
		console.log( err ); 
	},
	done : function( client )
   	{
		client.part( '#user1' );
		client.join( '#user3' );
    	}
});

Parameters

user (required)

Username of Twitch account to use.

pass (required)

Password for the account. Passwords for Twitch chat can be generated here.

channel (optional)

Array of channels to initialise the stream with. Note that channels have to be prepended with '#'.

data (optional)

Called every time a message is posted in one of the connected channels.

Is passed an object with attributes 'user', 'message' and 'channel'.

done (optional)

Called when a connection has been made. Is passed a slate-irc client object. The stream can be manipulated through this object e.g. joining channels, leaving channels etc.

The interface this object presents is the same as the slate-irc client, however all slate-irc client functions that do not have a callback now have an optional callback as the last parameter.

This is because the client object enforces the rate limit; commands sent through the client that are over the rate limit are queued (first in, first out) and executed at a later point in time. When the command is executed, the callback is fired.

error (optional)

Called when an error occurs. Is passed the error as the first parameter. The close event will occur directly after this event.

close (optional)

Called when the connection has closed.

License

MIT

0.3.1

7 years ago

0.3.0

7 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago