Meta bundle that ties together functionality from other "lfg" helper bundles.
lfg-nucleus is useful for normalizing and centrally managing events from multiple other bundles. At this time, lfg-nucleus integrates with:
- lfg-hypetrain
- lfg-siphon@~0.5.0
- lfg-streamtip@~1.0.0
- lfg-sublistener@^3.0.0
lfg-nucleus depends on:
- lfg-filter@^4.0.0
lfg-nucleus emits three events: subscription
, cheer
, and tip
.
nodecg.listenFor('subscription', 'lfg-nucleus', subscription => {
// do work
});
nodecg.listenFor('cheer', 'lfg-nucleus', cheer => {
// do work
});
nodecg.listenFor('tip', 'lfg-nucleus', tip => {
// do work
});
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
});
};
{
"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
}
}
{
"name": "langeh",
"timestamp": 1456809533513,
"id": "8f2ea9cb-2e8f-45dd-8645-0b724b2774f6",
"read": false,
"type": "cheer",
"amount": 1000,
"formattedAmount": "1,000",
"comment": "Hi streamer!",
"email": "email@alexvan.camp",
"profileUrl": "https://twitch.tv/langeh",
// Will be "daily" or "monthly" if this tip is the top cheer of the day or month.
"top": null
}
{
"name": "langeh",
"timestamp": 1456809533513,
"id": "8f2ea9cb-2e8f-45dd-8645-0b724b2774f6",
"read": false,
"type": "tip",
"amount": 5,
"currency": "$",
"formattedAmount": "$5",
"comment": "Hi streamer!",
"email": "email@alexvan.camp",
// Will be "daily" or "monthly" if this tip is the top tip of the day or month.
"top": null
}