Help me create a custom command

Okay!
1 more help my friend.
I want to create some points system in my youtube stream according to which I will select moderators.
For example Lets say I will call those points - mentos (1 hr - 1mentos)
10 mentos to become a mod.

And I want the program to work in this way!
User : mod!
Nightbot : Hello $(user). You are subbed to this channel from (date or time period) and watched the stream for 7 hrs in total (if its possible to tell for how much he watched in total)
Now if user is not qualified for mod -> You collected 7 mentos and need (10-7) mentos more to become a mod!
And if user qualified -> Congo! Check description to become a mod.

I would be grateful if you can guide me to make this command. :blush::+1:

Sorry to say, Nightbot neither has a loyalty points system nor does it keep track of viewer watch time. Twitch does keep track of watch time but but doesn’t publicly expose that information, so Nightbot cannot fetch that data.


However, there are other Twitch bots that (kind of) keep track of viewer watch time and have points systems. A couple bots that come to mind are Streamlabs Chatbot and Vivbot.

1 Like

Thanks
Same error as said -:
Check this please -:
Earlier there was space after end of each command.
I removed it and still it doesn’t works the way ur command works :frowning:

I am going to change the tokens, dont take tntn.

The commands I had on my dashboard were different from what I posted here. !bg and !bgreset do not need to be changed. These are now updated versions of the !boy and !girl commands, and they should work now. Replace the public and private tokens:

!addcom -cd=5 !boy -a=!bg PRIVATE_TOKEN$(eval `$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&no_id=1&data=-$(user)-)`.split(`|`)[0]!=`-$(user)-`?`&data=-$(user)-|~BOY~`:`e`) BOY

!addcom -cd=5 !girl -a=!bg PRIVATE_TOKEN$(eval `$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&no_id=1&data=-$(user)-)`.split(`|`)[0]!=`-$(user)-`?`&data=-$(user)-|~GIRL~`:`e`) GIRL
1 Like

I checked everything and the command is working superbly!
Thank you so much for creating this command.

Important
Dude! All these things are looking too difficult for me and that’s why I can’t even make what I want without bothering you. And if this is easy and not complicated for you then can you please make something like this for me -: (I hope this needs editing in !bg only)

I need your code to work like this -:

User1: !Boy
Nightbot: $(user) 1 boys have joined this stream. Cheers boys squad!
User2: !girl
Nightbot: $(user) 1 girls have joined this stream. Cheers girls squad!
User: !bg
Nightbot: $(user) 1 girls and 1 boys are watching this stream. Use !boy or !girl to join your squad.

If making this command exceeds the words limits then, please make nested commands( or whatever we call interlinked commands).
Take your full time, 1 day or 1 week. I am not in hurry. I really appreciate your help.


I was just curious to know one thing.
What is this --> https://twitch.center/customapi/quote/generate?
Is this something created by twitch itself or somebody else.
And will it work in youtube too? I know you answered that yes these commands work on both platform but I am confused why twitch features are working in youtube (If this is created by twitch).

Everything working fine.
Just want to gather knowledge about what are these and how are they working!
So that I can come with some new ideas to make my Nighbot more interactive!

And the last question -:
There is no way to find which user is interactive in my streams (youtube) and hence I can’t select regular members on loyalty. SO only reason to make someone mod in youtube is my observation and trust! Just confirming. I am new in this field and don’t have any idea and experience.

Much of the credit goes to Ehsan Kia for developing his ever so versatile quote list custom API. It was originally intended for streamers to use to store and pull quotes from at random, but it works quite nicely as a method for Nightbot to store and grab ANY kind of information. The URL has Twitch in its name, but it can be used wherever you are using Nightbot (Twitch, YouTube, or Discord).


I will get back to you with the commands rewritten to suit what you want.

1 Like

@qwerty

New command responses for !boy, !girl, and !bg. Remember to replace PUBLIC_TOKEN with your public token and PRIVATE_TOKEN with your private token:

!boy:

PRIVATE_TOKEN$(eval `$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&no_id=1&data=-$(user)-)`.split(`|`)[0]!=`-$(user)-`?`&data=-${decodeURIComponent(`$(querystring $(user))`)}-|~B~ Y`:` N`) boys

!girl:

PRIVATE_TOKEN$(eval `$(urlfetch https://twitch.center/customapi/quote?token=_TOKEN&no_id=1&data=-$(user)-)`.split(`|`)[0]!=`-$(user)-`?`&data=-${decodeURIComponent(`$(querystring $(user))`)}-|~G~ Y`:` N`) girls 

!bg:

$(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=$(1))`;a=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`;b=a.match(/~B~/g);b=b!=null?`${b.length} boys`:`0 boys`;c=a.match(/~G~/g);c=c!=null?`${c.length} girls`:`0 girls`;if(`$(1)`.includes(`PRIVATE_TOKEN`)){d=`$(3)`==`boys`?b:c;`$(user) ${d} have joined this stream. Cheers $(3) squad!`;}else{`$(user) ${b} and ${c} are watching this stream. Use !boy or !girl to join your squad.`;})
2 Likes

@RokettoJanpu

Is there any way to create a custom night bot command which will only work when a certain minimum amt of people will use it.

Like suppose my stream lags,
then people will spam lag.
And if like 30 people spam lag then night bot will reply “Guys Refresh”. Something like this?

Also, you gave me a command to reset wwcd and bg.
Can you please make a command to reset bg only?
Name -!bye

Thank you for commands.
These are working flawlessly!
:smiley::smiley::smiley:

You can set up a command which triggers every 30 uses like so:

!addcom -cd=5 lag $(eval $(count)%30==0?`Guys refresh!`:` `)

However Nightbot can only detect the word “lag” being said in chat as fast as once every 5 seconds. This will not work very well if you have many users spamming “lag” in chat.


I set up !bgreset below. Replace the private token:

!addcom -ul=mod !bgreset $(eval a=`$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)`;`$(user) has cleared the viewer list.`)
1 Like

Hey!
Two questions- :slight_smile:
If I need to change total counts then I need to replace 30?
Also, I have few more commands which I want to work under the same condition, to make them work is this the syntax -: $(eval $(count)%Number==0?**Message**:)

And suppose user lv of command is a subscriber, and if any other random guy will try to use command, can nightbot message him saying you need to be a subscriber(or whatever is req user lv) to use commands?

The “lag” command is set up such that Nightbot says the message every 30 uses (30, 60, 90, etc). To change how many times the command must be used before Nightbot says the message, just change the number.


If a command is set to a certain level (subscribers for example) then the command will never respond to any user below subscriber, and it’s not possible to set up the command such that Nightbot will give an alternate response to the user.

1 Like
$(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=$(1))`;a=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`;b=a.match(/~B~/g);b=b!=null?`${b.length} boys`:`0 boys`;c=a.match(/~G~/g);c=c!=null?`${c.length} girls`:`0 girls`;if(`$(1)`.includes(`PRIVATE_TOKEN`)){d=`$(3)`==`boys`?b:c;`$(user) ${d} have joined this stream. Cheers $(3) squad!`;}else{`$(user) ${b} and ${c} are watching this stream. Use !boy or !girl to join your squad.`;})

this commands have more than 400+ characters and I am not able to add in nightboard dashboard

@xloss

When adding commands through the dashboard, command responses are allowed to have up to 500 characters. Adding the !bg command should work.

you are wrong it only allow limited characters

Looks like you’re adding the command on YouTube. YouTube commands have a 200 character limitation as opposed to Twitch’s 500 character limit. Not sure how I can edit the command response to fit within the YT limit.

Is there any solution ? by using pastebin raw file or something else

I’ve tried rewriting !bg such that I can store as much $(eval) code as I can in a pastebin so as to fit the command in the 200 char limit, but I’ve had no luck since the 2 $(urlfetch)’s used to add to and read off the list leave very little room for anything else.

@xloss

Rewritten command responses for !boy, !girl, and !bg to fit within the 200 character limit. Remember to set !boy and !girl as aliases of !bg, and replace PUBLIC_TOKEN with your public token and PRIVATE_TOKEN with your private token:

!boy:

addquote?token=PRIVATE_TOKEN$(eval `$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=-$(user)-)`.includes(`-$(user)-`)?`&data=-$(querystring $(user))-|~B~ Y`:` N`) boys

!girl:

addquote?token=PRIVATE_TOKEN$(eval `$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=-$(user)-)`.includes(`-$(user)-`)?`&data=-$(querystring $(user))-|~G~ Y`:` N`) girls

!bg:

$(eval a=`$(urlfetch https://twitch.center/customapi/$(1))$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`;z=`$(3)`;$(urlfetch json https://pastebin.com/raw/NfuT0svq))
1 Like

Your are the man RokettoJanpu

thank you so much ,
:slight_smile: