Socket
Socket
Sign inDemoInstall

twitch-cpr

Package Overview
Dependencies
4
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    twitch-cpr

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


Version published
Weekly downloads
14
increased by1300%
Maintainers
1
Install size
1.90 MB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 19 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc