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 = ; const mysql = ; // Required for 2.0 Upgradeconst tmi = ; // Recommended for chat functionality, though not strictly necessary to function.const config = ; // Great to store variables safely
Building the Config
let twitchCPRopts = channel_name: configdefaultstreamer // REQUIRED! channelID: configdefaultchannel_id // REQUIRED! authorization: configidentityauthorization // REQUIRED! OAUTH ****************** This is unique to this service/account combination. Info on Github. debug: `false` database: true mysql: host: configmysqlhost user: configmysqluser password: configmysqlpassword database: configmysqldatabase
Implement and Call the Class
const Twitch_CPR = ;// Call once per commandconst twitchCPR = twitchCPRopts configdefaultchannel_id configdefaultstreamer; // user-id === room-id in deployment, channel derived automatically
USE
Toggle a Reward
twitchCPR;
Pause a Reward
twitchCPR;
Unpause a Reward
twitchCPR;
List Rewards Profiles
twitchCPR;
Create a Reward
twitchCPR;
Delete a Reward
twitchCPR;
Update a Reward
twitchCPR;
Switch a Reward
twitchCPR;
Call Version
twitchCPRversion;
Developed by Cazgem for personal use at (https://twitch.tv/cazgem) as well as for his chatbot, Polyphony.