NightDev Community Forums

Complete beginner here

Hey guys I’ve tried searching the forums but haven’t had any luck with finding an answer. While trying to find some commands that I can add to twitch which involve code I’ve found a lot of commands with an $eval at the start. I’ve tried adding them as commands but it just shows the code instead of what I want the code to do when the command is typed in. I assume there’s something I’m missing or something extra I need however I’m not sure where to get this information or where to start.

1 Like

Well for the eval variable or any variable with nightbot you have to format a specific way in the case of eval it is $(eval JS_CODE)

For a better understanding I recommend you read the custom variable section of the docs. https://docs.nightbot.tv/

Though for most general things with nightbot you can find documentation on how it works at the above link too, not just the variables.

Also for future reference the commands you’ll find on here typically look the way they should when you add it without the need to remove any parentheses or characters (unless specifically noted) as that is important for how nightbot reads the command.

1 Like

Thanks for your response! I’ve checked out the link and will keep reading however the question I have is why I can’t get any kind of eval variable to work even using the simple examples in the eval guide and copy and pasting the examples in the forums without editing them? Provided the JavaScript code is all correct should it just work when I add it as a command in twitch chat?

1 Like

Yes the examples on the forums should work how are you adding the commands? There’s a few things I think that could cause that. If your adding it on mobile via the twitch app that could be the issue.
Also if you could add this command and attach a screen shot of what your seeing when you go to use it.

!addcom !test $(eval 1+1)
1 Like

I am using the twitch app actually, does it not work in the twitch app? If so would it work via the twitch website in the browser?
I tried adding that but nothing comes up when I do.

1 Like

Ok is this in a stream you moderate for or your own? Because if it’s your own I 100% recommend adding commands through the dashboard.

As for the potential issue with mobile I noticed some time ago probably over a year that when copy and pasting anything with " in it became “ which is not good because it will cause the code to not function.

Whenever you say this you mean nightbot did not respond at all. But it is replying to other messages right?
For that you just need to copy and paste everting in the block exactly as is. Is that what you did?

1 Like

Yeah it’s my stream.

Yeah I copy and pasted it exactly as is and night to didn’t respond. I also originally tried adding through the dashboard through a browser but had the same issue unfortunately.

Same issue when I put the same thing in through the browser with nightbot not doing anything.

1 Like

Ok I’m kinda stumped tbh what are the error messages you are receiving? Also screenshots would be very helpful of you adding the commands and the responses.


image

I added this command through the dashboard through the browser. When I type that command into chat should it come up with 2 instead of the code?

There’s no error messages it just shows the code exactly as is (if I’m using eval) instead of executing the code.

Ok you are not using nightbot your using stream elements which explains the issue your having because they are two completely different things please contact them for help with anything related to their bot https://support.streamelements.com/en
I’m sorry I can’t be of more help but these forums are for nightdev products specifically.

I feel dumb but I’m glad I’m atleast making progress! I’ll do some googling. Is there a seperate dashboard for nightbot that can generate its own commands in chat?

Yes streamelements and nightbot work completely independent of one another and the commands they use are incompatible with eachother.
If you are interested in nightbot you can set it up here https://nightbot.tv/

Ok amazing! I think it all just clicked, I’m so happy I found the problem and it was something as easy as that, thanks for all your help!

After looking into it everything seems to be working fine! I had one question though, I’ve seen on other streamers command lists that they have their code hidden as just [eval] in some of their commands instead of showing all the code, how do I set that up so my code is hidden?

All arguments in command variables are hidden for privacy reasons. No additional settings are needed to turn it on for yourself.

Your code is already hidden for people other than you, you can see this by opening your command list in private mode.

1 Like