Multiple Sub responses?


#1

Is it possible to set multiple responses When a user subscribes? Instead of having the usual:

(name) has subscribed!

I wanna set it to have:

(name) has subscribed!
Bot spams a couple emotes
Bot reminds user to join the streamers discord to gain access to subscriber role in there.


#2

Possible? Yes.

Possible with the existing subscribeHandler.js? No.

You’d have to go in and modify the script. The easiest solution would be to put the responses in an array then use the random function ($.randRange) to pick a random element to send.


#3

Mind giving me an example of what you mean? Im not a coder so i’d only understand by looking at a provided example.


#4

Plus, The way i want it to play out is that it will post MULTIPLE messages PER sub. Not just random ones from a list. I mean like if i write out 3 seperate messages. I want ALL 3 of them to be posted, 1 after another, anytime someone subs


#5

You’d still need to modify to make it send extra messages. This will eat up quite a bit of the bots queue in the event of a ‘sub train’ so it’s not advised.


#6
  1. Open subscribeHandler.js in your botFolderName/scripts/handlers/.

  2. Add this code on line 106:

     /*
     * This is the beginning of custom tag.
     */
     if (message.match(/\(runcode/)) {
     	var code = message.match(/\(runcode (.*)\)/)[1];
    
     	try {
         	eval(code);
     	} catch (ex) {
         	$.log.error('Failed to run custom code: ' + ex.message);
     	}
     	return null;
     }
     /*
     * This is the end of custom tag.
     */
    
  3. Add this response for the subscription event in Alerts tab in PhantomBot Panel:

(runcode $.say(event.getSubscriber() + ' has subscribed!') + $.say('PurpleStar BibleThump Kappa') + $.say('Join my discord to gain access to subscriber role in there');)

P.S. If you also want this to work for prime subscription, re-subscription and gifted subscription, then you need to repeat step 2 on lines 133, 175, 222, and 265. Note that the numbers of the following lines shift after you insert the code. Don’t forget to backup subscribeHandler.js first.

NOTE
This instruction is actual for PhantomBot version 2.4.2.
The solution and the code are possibly imperfect.
I’m not responsible for any possible errors, crashes, data loss, etc. resulting from the operation of this script.


#7

Do remember that this is 3 says in a row, Twitch has strict rate limits and PhantomBot places all messages into a queue. During a sub train, this could overload the queue and result in the bot not responding to any commands and it might not be able to moderate (time/ban people). You are limited to 19 messages in 30 seconds.


#8

Okay, I understand. 1 more thing… Does this response occur if people gift sub bombs? if yes, can i disable it for gift subs xD


#9

This is here already?


#10

I don’t know what version of the bot you’re using. Correlate the line numbers yourself according to the current version of subscribeHandler.js for which I specified the line numbers.


#11

I’m just gonna leave it at that cus i honestly haven’t got a clue, mate! Thanks for trying to help though <3


#12

Hi Guys…

Is there any way to do the same with Streamlabs donations?

Mwirenfeldt


#13

Sure, start new thread for your request.