Help me create a custom command

Hello! I need help!
I want to know is there any way that count command increase count only once for a single user?
Like my command is !Hi and output is $(count) Hi. If a single user comment !Hi 2 times then Nightbot will increase count from 0 to 1 only once…

Also, I noticed that nightbot doesn’t reset the count after the end of each stream.
Is there any automatic way that it will start the count from 0 for every new stream?

@qwerty

Are you the same user as alphemale1? You previously asked for a set of commands, !boy and !girl, that added to the number of male and female viewers, respectively. Do you still need those commands or do you need commands for what you’re asking in this post?

1 Like

Why are you creating multiple topics with different accounts?
Can you not delete your old posts, other people browsing the forum might find it usefull. :thinking:

1 Like

Same user! I need that boy girl syntax @RokettoJanpu
k last account no shitty job this time
i am new and learning and new users cant create more than 3 posts thats y! @xgerhard

Sorry for that!
I will write all my posts again in this account with the working syntax Roketto given me.

@qwerty

The following command setups use ehsan’s quote list API.


Click this link. It will generate three links and two tokens, a public token (8 characters long) and a private token (16 characters long). The public token is located within the first generated link. The private token is located within both the second and third generated links. The tokens are found after token=and before &data=$(querystring) Copy them down and keep them somewhere safe!

I have set up 4 commands below: !boy, !girl, !bg, and !bgreset (users will not use !bg directly, that is another command that !boy and !girl are passing input to). !boy and !girl will increase the boy/girl viewer count by 1, but only if the command user has not used either command before. !bgreset (mod-only) will clear both the boy/girl viewer counters and allow all users to use the commands again. Copy and paste the following command setups into chat one by one to add the commands. Replace PUBLIC_TOKEN with your public token and replace PRIVATE_TOKEN with your private token.

!addcom -cd=5 !boy -a=!bg PRIVATE_TOKEN$(eval `$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&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&data=-$(user)-)`.split(`|`)[0]!=`-$(user)-`?`&data=-$(user)-|~GIRL~`:`e`) GIRL

!addcom -cd=5 !bg $(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=$(1))`;d=decodeURIComponent;if(d(`$(1)`).includes(`PRIVATE_TOKEN`)){b=decodeURIComponent(`$(2)`);c=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`;if(b==`BOY`){d=c.match(/~BOY~/g);e=d!=null?`${d.length} boys`:`0 boys`;}else{d=c.match(/~GIRL~/g);e=d!=null?`${d.length} girls`:`0 girls`;}`${e} are watching this stream.`;}else{`Use !boy or !girl`;})

!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

@RokettoJanpu
Thanks for the help.
I also have one more counter command. I think I should make a command like !bye which will run !bgreset and count reset.
However, how can I reset my another count?

It is like this -:
Command- wwcd
Output -: $(user) shared his chicken dinner with everyone. [ $(count) chicken dinners have been shared in this stream! ]
I want to reset this count also.

Also I am making all these for yt. Will this token work there too? [ I know I am dumb]

Copy and paste this in chat create a command called !wwcdreset that resets the $(count) value in wwcd:

!addcom !wwcdreset -a=!editcom wwcd \-c=0

Copy and paste this in chat to create a command called !bye which will both reset the $(count) value in wwcd and reset the boy/girl counters. Replace PRIVATE_TOKEN with your private token:

!addcom !bye -a=!editcom wwcd \-c=$(eval a=`$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)`;`0`)
1 Like

Hey Hey Hey!
Wait a minute!
What is this -> !addcom ?
In all your syntax you added this line! Whats its use. I have to remove these words otherwise nightbot puts these words in his replies also.
What I do -> I create a new command and paste all your syntax in message box. Am I doing this wrong?

Also I think this boy/girl commands will not work in youtube and its not even possible in youtube right now. Am I right?

There are two ways to add commands, through chat and through the dashboard. What I gave you was meant to be copied and pasted right into chat. The syntax for adding commands through chat is:

!addcom [command name] [command response]

As for YouTube, you must be live for Nightbot to show up in chat, your stream must be set to public, and you must be viewing Live Chat to see Nightbot’s responses.

The commands should work on both Twitch and YouTube.

1 Like

Okay I will try boy/girl command on youtube!
I want to know that when i reset wwcd the bot shows a message like command edited successfully. I dont want bot to message this in chat. Possible?

Sorry, it is not possible to block the result of any command that edits another command.

1 Like

Right now I am trying these commands on twitch.
I, myself is sending messages !boy and !girl.
And count is increasing after each command.
Is this happening because owner is commanding and will not happen for other users or there is some syntax error. I carefully checked everything and have 0 error while creating commands. Help me.

@qwerty

boygirl

Double check that you copied and pasted every command verbatim and that you put in your tokens in the appropriate spaces. Perhaps also check that you did not play any unnecessary spaces that would affect the $(eval) scripts.

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