1.0.1 • Published 8 years ago
streamtip v1.0.1
streamtip
A Node.JS wrapper for the Streamtip API.
Installation
npm install streamtip
Usage
const StreamTip = require('streamtip');
let opts = {
clientId: '12345', // Your Client ID, from the Streamtip account page
accessToken: '67890' // Account Token, again from the account page
};
let streamtip = new Streamtip(opts);
streamtip.on('connected', () => {
// Successfully connected to Streamtip, but not authenticated yet!
console.log('connected!');
});
streamtip.on('authenticated', () => {
// Now authenticated, we can expect tip alerts to come through
console.log('authenticated!');
});
streamtip.on('authenticationFailed', () => {
// ClientID or Access Token was rejected
console.log('authentication failed!');
});
streamtip.on('ratelimited', () => {
// Too many bad authentications = ratelimited
console.log('rate limited!');
});
streamtip.on('newTip', tip => {
// We got a new tip.
// 'tip' is an object which matches the description given on the Streamtip API page
console.log(`new tip! ${tip.username} has tipped ${tip.currencySymbol}${tip.amount}!`);
});
streamtip.on('error', err => {
// An unexpected error occurred
console.log(`error! ${err.message}`);
});
Contributing
- Fork the project
- Create your feature/fix on a new branch
- Create a new pull request pointing to that branch
License
'streamtip', this project, is copyright (c) Matthew McNamara and provided under the MIT license, which is available to read in the LICENSE file.
Streamtip itself, at streamtip.com, is copyright (c) NightDev, LLC.