How to reward users with points for cheering with bits using PhantomBot

About

Note: I am not a lawyer, and this guide is only to show you HOW to reward bits with points. Whether you decide to do so or not is your own decision.

PhantomBot is a self hosted Twitch bot, with lots of features.

One of the features is a points system which allows users to earn points by doing certain things, like watching the stream, playing chat games and donating money.

However, there is no option to reward users with points for cheering using bits.

Why? Well, the reason is the Twitch terms of service, which has some very confusing terms, one of which includes the following:

“offer[ing] Bits in exchange for real or virtual currencies or any other consideration or items of value whether inside or outside of the Twitch Service.”

People have taken this to mean rewarding viewers for cheering is against the Terms of Service. However, this is most likely referring to people offering bits in exchange for real money, or crypto-currencies such as Bitcoin (i.e. I offer someone $50 to buy $100 worth of bits mined by watching ads).

I have asked Twitch for clarification on the matter, but their support is slow and useless. They most likely don’t care, as they’re still making money from it either way. Therefore I have written this guide as I believe PhantomBot uses should be given the choice to reward users who cheer with bits in the same way they do people who donate through other means.

Adding the option

To reward users with bits we need to modify one file.

The file we need to modify is called “bitsHandler.js” and is located in the following folder

<root phantombot folder>/scripts/handlers/

Open this file in your text editor, and you should see the following text on the 9th line

announceBits = false;

Modify this line to the following

announceBits = false, bitsReward = 1;

1 is the amount of points we want to reward the user with for each bit donated. If you leave this set to 1, it means that if the user donates 100 Bits ($1USD) they will receive 100 points.

After you have done this, find the following text in the same file

$.bind(‘bits’, function(event) {
var username = event.getUsername(),
bits = event.getBits(),
s = message;

Directly underneath the text, add the following

/*
reward user with points for giving bits
*/
$.inidb.incr(‘points’, username.toLowerCase(), (bits * bitsReward));

And that’s all there is to it! Your users should now be rewarded with points when cheering with Bits.

Tips/things to note

As I said at the start of the post, I am not a lawyer, and this guide is only to show you HOW to reward bits with points. Whether you decide to do so or not is your own decision.

Should Twitch ever actually bother replying to me, I will update this post.

Thanks for reading.