Skip to content

Latest commit

 

History

History
119 lines (98 loc) · 2.89 KB

README.md

File metadata and controls

119 lines (98 loc) · 2.89 KB

lfg-nucleus Build Status

Meta bundle that ties together functionality from other "lfg" helper bundles.

screenshot

lfg-nucleus is useful for normalizing and centrally managing events from multiple other bundles. At this time, lfg-nucleus integrates with:

lfg-nucleus depends on:

Using in your bundle

lfg-nucleus emits three events: subscription, cheer, and tip.

In a graphic or dashboard panel

nodecg.listenFor('subscription', 'lfg-nucleus', subscription => {
    // do work
});

nodecg.listenFor('cheer', 'lfg-nucleus', cheer => {
    // do work
});

nodecg.listenFor('tip', 'lfg-nucleus', tip => {
    // do work
});

In an extension

First, add lfg-nucleus to your bundle's nodecg.bundleDependencies.

Then, create code like the following:

module.exports = function (nodecg) {
    const nucleus = nodecg.extensions['lfg-nucleus'];

    nucleus.on('subscription', subscription => {
        // do work
    });

    nucleus.on('cheer', subscription => {
		// do work
	});

    nucleus.on('tip', tip => {
        // do work
    });
};

Data Structures

Subscription

{
    "name": "langeh",
    "timestamp": 1456809247462,
    "id": "852d1475-6bac-4abe-bcd1-e5805db1caa1",
    "read": false,
    "type": "subscription",
    "channel": "chrishanel",
    "months": 3,
    "resub": true,
    "profileUrl": "https://twitch.tv/langeh",
    
    // Only present when lfg-hypetrain is installed.
    "train": {
        "passengers": 239,
        "dayTotal": 39,
        "threshold": 10,
        "isHype": true
    }
}

Cheer (bits)

{
    "name": "langeh",
    "timestamp": 1456809533513,
    "id": "8f2ea9cb-2e8f-45dd-8645-0b724b2774f6",
    "read": false,
    "type": "cheer",
    "amount": 1000,
    "formattedAmount": "1,000",
    "comment": "Hi streamer!",
    "email": "[email protected]",
    "profileUrl": "https://twitch.tv/langeh",
    
    // Will be "daily" or "monthly" if this tip is the top cheer of the day or month.
    "top": null
}

Tip

{
    "name": "langeh",
    "timestamp": 1456809533513,
    "id": "8f2ea9cb-2e8f-45dd-8645-0b724b2774f6",
    "read": false,
    "type": "tip",
    "amount": 5,
    "currency": "$",
    "formattedAmount": "$5",
    "comment": "Hi streamer!",
    "email": "[email protected]",
    
    // Will be "daily" or "monthly" if this tip is the top tip of the day or month.
    "top": null
}