Skip to content

SupportClass/lfg-doncorleone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lfg-doncorleone

This is a NodeCG bundle.

Listens for donations to a given account on Barry's Donation Tracker and emits API events for other bundles to use. Also displays stats on the dashboard and easily allows the user to reset said stats.

Installation

  • Install to nodecg/bundles/lfg-doncorleone
  • Create nodecg/cfg/lfg-doncorleone.json with the username and password of the Barry's Donation Tracker account that you wish to listen to:
{
    "username": "myUsername",
    "password": "myPassword"
}

Usage

As a dashboard panel

If you simply want to see top donations for the day and month periods on your dashboard, you are done.

In other bundles' view pages and dashboard panels

If you would like to use this data in another bundle, add the following code to your view/panel:

nodecg.listenFor('tip', 'lfg-doncorleone', callback);

... where 'callback' is the name of a function with the signature function callback(data)

In other bundles' extensions

If you want to use donation events in another bundle's extension, add lfg-doncorleone as a bundleDependency in your bundle's nodecg.json

Then add the following code:

var donCorleone = nodecg.extensions['lfg-doncorleone'];

donCorleone.on('initialized', function initialized(data) {
    // do work
    // data.Completed = Array of recently completed donations
    // data.totals = Object containing stats such as data.totals.day_top and data.totals.month_top
    // Other properties exist as well
));

donCorleone.on('gotDonations', function gotDonations(data) {
   // do work
   // data object is the same as in the 'initialized' event
   // However, in this event 'data.Completed' is only newly completed donations.

   // Example of iterating over the data.Completed property and processing each new donation
   data.Completed.forEach(function(donation) {
       console.log(donation);
   });
));

License

lfg-doncorleone is provided under the MIT license, which is available to read in the [LICENSE][] file. [license]: LICENSE

About

Easy donation listening for NodeCG

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published