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.

How to set up PhantomBot on a Linux VPS/server

About

PhantomBot is an open-source Twitch bot which runs on your own computer (unlike web-based bots like Nightbot)

However, some people might like to keep the bot on a separate computer. This way it uses no resources on your gaming/streaming PC and can be left on 24/7 without keeping your PC on.

This guide will show you how to set up PhantomBot on a Linux (Debian-based) VPS

It should work on a VPS/dedicated server with most providers, but I recommend using Vultr as they are a solid provider, with ultra fast hardware and network, and have locations all over the World.

VPS/Requirements

The VPS I will be using is a 512MB RAM VPS from Vultr running Debian 9 (Stretch). Using the latest version of the OS is important as it includes the required version 8 of openjdk. However this guide should work on any OS based on Debian (i.e. Ubuntu)

Creating and connecting to the VPS

Note: you can skip this bit if you know how to connect to your server

Once you have signed up at Vultr, you will be able to create a VPS. Just go to Servers then click the plus sign (+) and choose your location by clicking on the flag (choose the country nearest to you, then click Debian and select 9 x64 then under Server Size choose the specs you want. You should be able to easily run Phantombot on the smallest 512MB RAM package, so choose this one for now. Once you click deploy, wait a few minutes for the server to be created.

Next, download PuTTY from this link. This is the program you will use to connect to your server and run commands. Open the file once it’s done downloading, and set it up like this

Host Name (or IP Address): the IP address given to you by Vultr on the “servers” page (or your VPS provider’s website/control panel)
Port: 22
Saved Sessions: in this box, type a name for your server like “PhantomBot”

After that, click Save, then click Open

Once you click that, a window should pop up and ask you for a password. This is the root password of your server, and will have been emailed to you by Vultr (or you can click on your server in the control panel, and click the eye next to Password.

Once you’ve logged in to your VPS you should see something similar to this

root@vultr:~#

If you see that, move onto the next step. If not, try again or post a comment below and I will try to help.

Setting up the VPS

Note: to paste something in PuTTY, just right click inside the window

Now we need to update our server and install some things. First, you may want to change the password.

To change your password type passwd and press enter. Then it will ask you to choose a password, and after pressing enter it will ask you to confirm it. Type it in again and press enter, it should say passwd: password updated successfully

Next, run the following command to update your server and install unzip (to unzip some files), nano (a commandline text editor which we will use later), openjdk-8 (version 8 of the open Java Development Kit, needed for PhantomBot to run), screen (used to run PhantomBot in the background when you disconnect from the server) and unattended-upgrades (to help keep your server secure)

apt-get update && apt-get -y dist-upgrade && apt-get -y install screen unattended-upgrades unzip openjdk-8-jdk-headless nano

If you used Vultr, it will most likely be updated and already have some of these installed, so shouldn’t take long.

Installing PhantomBot

Note: to paste something in PuTTY just right click inside the window

 

Visit the PhantomBot website and find the “Stable” release. Right click on “Download” and choose “copy link address” then type in the following command, replacing the link below with the link you got from the website

wget https://github.com/PhantomBot/PhantomBot/releases/download/v2.3.9/PhantomBot-2.3.9.zip --no-check-certificate

Next we need to extract the folder from the zip file. Type in the following

unzip PhantomBot*.zip && rm PhantomBot*.zip

Next we need to navigate to the PhantomBot folder, and then make some files executable so we can run them. Type (or copy/paste) the following command to change to the folder

cd PhantomBot*

Then type the following command to make the files executable

chmod u+x launch-service.sh launch.sh

Now we’re ready to start up a screen session and run PhantomBot. First type the following command to start up a screen session

screen -S bot

Now we can start PhantomBot, and it will keep running when we disconnect from the server! Type the following command to start PhantomBot

./launch.sh

Answer the questions asked by PhantomBot and press enter

Once you have set up the bot, do the following

Hold Ctrl + A, then press D while still holding them

You can now close, PuTTY down and disconnect from the server

To configure PhantomBot, open your web browser and visit the following address, where (YOURIP) is the IP address of your VPS (for example, it might be something like http://1.1.1.1:25000/panel)

http://YOURIP:25000/panel

The username and password is the username and password you specified during the set up of PhantomBot

Tips/things to note

For song requests, instead of /panel you would use /ytplayer and for the song request list it’s /playlist so you can link to this in your chat by making a command called !playlist (easily done in PhantomBot)

Any issues/problems

If you have any issues at all, please leave a comment below.