Adjusted Subscriber Count on Twitch

Hi, So I am trying to make a command for a streamer. I want to do a !subcount command but to adjust the numbers a little bit. The streamer has himself, nightbot and one more account “subscribed” to him, but he does not want these three extra subscribers to show up when you do !subcount or !subscribercount. I am aware that usually you would use the command “$(twitch subcount) people are currently subscribed,” but is there a way that I can make the actual number be just subtracted by three. Thank you!

This code should work:

!commands add !subcount $(eval response = `$(twitch subcount)`; count = parseInt(response); if (isNaN(count)){response} else {count -= 3; if (count < 0){count = 0} count + " people are currently subscribed"})

You can make !subscribercount an alias to !subcount

2 Likes

how do you get nightbot as subscriber?

You have to contact twitch partner support and ask to give nightbot a free sub.

I tried that and got this response. []

When I originally tested that code, I added it through the Nightbot.tv Dashboard. Apparantly, when you add this command through the chat, the -= doesn’t get added. See the image below for what command actually gets added when you add the command through Twitch chat:

Here is a different version of my code that avoids this bug with Nightbot:

!commands add !subcount $(eval response = `$(twitch subcount)`; count = parseInt(response); if (isNaN(count)){response} else {(count <= 3 ? 0 : count - 3) + " people are currently subscribed"})

Hi, sorry if this is annoying you, but when I tried your code it just gave me the subcount without subtracting the three extra viewers. I’m not sure if what i am asking for is even possible and if it is too much to ask you do not have to keep helping me. Thank you for all of your help so far! I really appreciate it.

It’s because he didn’t actually subtract 3 anywhere. If you use this it should work.

!commands add !subcount $(eval response = `$(twitch subcount)`; count = parseInt(response); if (isNaN(count)){response} else {(count <= 3 ? 0 : count - 3) + " people are currently subscribed"})
1 Like

thank you so much <3

His version is needlessly verbose anyways, since you know that there are always at least three subs. this would also work

!commands add !subcount $(eval $(twitch subcount) - 3) people are subscribed
1 Like

Yes, I forgot to add the - 3 in my above code. This is the correct code:

!commands add !subcount $(eval response = `$(twitch subcount)`; count = parseInt(response); if (isNaN(count)){response} else {(count <= 3 ? 0 : count - 3) + " people are currently subscribed"})

It is not needlessly verbose. If you do $(twitch subcount) without any subscriptions, you will get “Channel does not have subscriptions.” If you try to subtract 3 from that, you will get the error “Right-hand side of ‘instanceof’ is not an object people are subscribed”.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.