This is a NodeCG bundle.
This bundle is an interface to Streen, a centralized WebSocket wrapper for tmi.js. Together, Streen and lfg-siphon enable one single tmi.js instance to power multiple NodeCG instances across many servers, containers, etc.
This bundle integrates with lfg-nucleus
.
- Install to
nodecg/bundles/lfg-siphon
- Create
nodecg/cfg/lfg-siphon.json
with a list of Twitch chat channels to listen to. - Configure a connection to your instance of Streen in
nodecg/cfg/lfg-siphon.json
.
{
"channels": ["dansgaming", "giantwaffle", "professorbroman"],
"streen": {
"url": "https://your-streen-deployment.herokuapp.com/",
"secretKey": "your_super_secret_streen_key"
}
}
If you simply want a list of recent subs on your dashboard, you are done.
If you would like to use this data in another bundle, add listen for the desired events in your view/panel.
Example:
nodecg.listenFor('subscription', 'lfg-siphon', data => {
console.log(data);
});
nodecg.listenFor('cheer', 'lfg-siphon', data => {
console.log(data);
});
If you want to use chat events in another bundle's extension,
add lfg-siphon
as a bundleDependency
in your bundle's nodecg.json
Then listen to the desired events in your extension.
Example:
const siphon = nodecg.extensions['lfg-siphon'];
siphon.on('subscription', data => {
console.log(data);
});
siphon.on('cheer', data => {
console.log(data);
});
From an extension only (will not work in graphics or dashboard panels):
const siphon = nodecg.extensions['lfg-siphon'];
Send a message to a chat channel. See the corresponding tmi.js docs for more info (link).
Times out a user on a channel for the given number of seconds. See the corresponding tmi.js docs for more info (link).
When connected to Streen.
Emitted when connected to Streen.
Emitted on every chat message. data
has the properties from tmi.js's chat
event
(docs).
Emitted when a user is timed out. data
has the properties from tmi.js's timeout
event
(docs).
Emitted when a mod clears the chat.
Emitted on both subscriptions and sub anniversaries (resubs). data
has the following properties:
data.username // Twitch username of the subscriber or resub
data.channel // What channel was subscribed to
data.resub // Boolean, whether or not this is a resub
data.months // If this is a resub, this will be the number of months they have been subscribed for
data.ts // Unix timestamp (in milliseconds)
Emitted when a user sends a Cheer to a channel that this instance of lfg-siphon is listening to.
data
has the following properties:
data.channel // What channel this Cheer occurred in
data.userstate // An object containing many details about this Cheer. `userstate.bits` will tell you the amount of bits cheered.
data.message // The message, if any, that accompanied the cheer.
data.ts // Unix timestamp (in milliseconds)
- Schmoopiie, whose tmi.js library makes this all possible
- Night, from whose OBS Chat embed service the
twitch-chat
element borrows code heavily.
lfg-siphon is provided under the MIT license, which is available to read in the [LICENSE][] file. [license]: LICENSE