Multiple Sub responses?

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.

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.

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

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

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.

  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.

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.

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

This is here already?

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.

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

Hi Guys…

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

Mwirenfeldt

Sure, start new thread for your request.

1 Like

Any way to make this work inn 3.0.0 after runcode is removed?

subscribeHandler.js has never supported (runcode) before, just as it doesn’t support this tag now. Read this post above carefully.

Since the use of (runcode) tag is considered unsafe, there is also another even easier way — just add support for multiple lines:

  1. Shutdown your bot, go to yourBotFolderName/scripts/handlers/, backup subscribeHandler.js, then open it.

  2. Add this code on line

  • #350 for Mass Anonymous Gifted Subscription event

  • #314 for Anonymous Gifted Subscription event

  • #275 for Mass Gifted Subscription event

  • #232 for Gifted Subscription event

  • between lines #184 & #185 for Re-Subscription event

  • #142 for Prime Subscription event

  • #115 for Subscription event

      	/*
      	* This is the beginning of custom tag.
      	*/
      	if (message.match('\n')) {
          	var splitMessage = message.split('\n');
    
          	for (var i = 0; i < splitMessage.length && i <= 4; ++i) {
              	$.say(splitMessage[i]);
          	}
          	return null;
      	}
      	/*
      	* This is the end of custom tag.
      	*/
    
  1. Add any multiple line response for the subscription event you want in Alerts tab in PhantomBot Panel. For example:
(user) has subscribed!
PurpleStar BibleThump Kappa
Join my discord to gain access to subscriber role in there

NOTE
This instruction is actual for PhantomBot version 3.0.0.
I’m not responsible for any possible errors, crashes, data loss, etc. resulting from the operation of this modification.

Thanks… works perfectly. :wink:

I dont know if you would prefer me making a new request, but i was just wondering if the code you posted above would be able to add to the followHandler.js also to make a split message? if it can be what line would it be added to on 3.0.0

If you would prefer new request please just let me know and ill make it
thank you