npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

twitch-cpr

v2.1.5

Published

Module meant as an extension to tmi.js that allows for the Pausing/UnPausing of Channel Point Rewards. Useful for switching between many game-specific rewards on the fly. Requires XMLHTTPREQUEST, TMI.JS. Recommended: MySQL or some other database to store

Downloads

24

Readme

twitch-cpr 2.1.5

Twitch-CPR is meant to act as an extension to Polyphony TwitchBot to allow for the automated pausing/unpausing of channel point rewards. It can also run as a stand-alone console application if you wish.

If you like what you see, consider visiting my patreon, or visit my twitch page for a paypal donation link.

What's New?

Automated MySQL Database Creation, Customized Table Name Version Call Code Cleanup

Installation

npm install twitch-cpr

To find Special Oauth keys:

  • Visit https://www.twitch.tv/popout/<username>/reward-queue as the account you wish to authorize for these actions.
  • Navigate to a reward.
  • Open the browser console.
  • Look at Network Activity, and click the Pause Redemptions Slider at the top-left of the page.
  • The Network Activity you are looking for is under "gql".
  • Grab your Authorization [OAUTH ************************] under Headers.

To generate a client-ID (if you don't have one already):

  • Visit dev.twitch.tv/console/apps
  • Next to your chatbot/applicaiton name, click "Manage"
  • Copy the text inside Client ID

Getting Reward IDs:

  • Visit https://www.twitch.tv/popout/<username>/reward-queue as the account you wish to authorize for these actions.
  • Navigate to a reward.
  • Open the browser console.
  • Look at Network Activity, and click the Pause Redemptions Slider at the top-left of the page.
  • The Network Activity you are looking for is under "gql".
  • Grab your Reward ID from Preview->0->data->updateComunityPointsCustomReward->reward->id.
  • Simple Reward ID fetcher coming soon to https://polyphony.me/twitch! (2.3)

Implementation

Includes

const twitchCPR = require(`twitch-cpr`);

const mysql = require('mysql'); // Required for 2.0 Upgrade
const tmi = require('tmi.js'); // Recommended for chat functionality, though not strictly necessary to function.
const config = require('./config'); // Great to store variables safely

Building the Config

let twitchCPRopts = {
    channel_name: config.default.streamer, // REQUIRED!
    channelID: config.default.channel_id, // REQUIRED!
    authorization: config.identity.authorization, // REQUIRED! OAUTH ****************** This is unique to this service/account combination. Info on Github.
    debug: `false`,
    database: true,
    mysql: {
        host: config.mysql.host,
        user: config.mysql.user,
        password: config.mysql.password,
        database: config.mysql.database
    }
}

Implement and Call the Class

const Twitch_CPR = require(`twitch-cpr`);
// Call once per command
const twitchCPR = new Twitch_CPR(twitchCPRopts, config.default.channel_id, config.default.streamer); // user-id === room-id in deployment, channel derived automatically

USE

Toggle a Reward

twitchCPR.toggle = function (rewardID, isPaused, twitchCPRopts);

Pause a Reward

twitchCPR.pause(rewardID);

Unpause a Reward

twitchCPR.unpause(rewardID);

List Rewards Profiles

twitchCPR.listGames(channel_id, channel_name, client);

Create a Reward

twitchCPR.newGame(game_id, channel_id, channel);

Delete a Reward

twitchCPR.deleteGame(game_id, channel_id, channel);

Update a Reward

twitchCPR.updateGame(game_id, channel_id, channel);

Switch a Reward

twitchCPR.switch(game_id, channel_id, channel);

Call Version

twitchCPR.version;

Developed by Cazgem for personal use at (https://twitch.tv/cazgem) as well as for his chatbot, Polyphony.