NightDev Community Forums

Help me create a custom command


#21

@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.`;})

#22

@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


#23

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


#24

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.`)

#25

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?


#26

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.


#27
$(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


#28

@xloss

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


#29

you are wrong it only allow limited characters


#30

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.


#31

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


#32

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.


#33

@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))

#34

Your are the man RokettoJanpu

thank you so much ,
:slight_smile:


#35
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

how it will work
? i mean direct copy paste into dashboard ?


#36

As shown in this picture:


#37

Okay < thank you so much <3 I am going to try this


#38

when i sent : !boy
it replyd me : Nightbot
​0 boys and 0 girls are watching this stream. Use !boy or !girl to join your squad.


#39

what is the alias of !bg


#40

!boy is aliased to !bg, !girl is aliased to !bg, and !bg has no alias.