New To Using NightBot 2018

Hello everyone,

We’re very new to Using Bots and We decided to use NightBot because we’ve seen it work great in so many other peoples streams. :smile:
I want to make sure I use it all correctly straight away and try to have my creative flare possible as well , but I don’t want to ruin my chat by accident for messing around with something I don’t fully understand.

I have watched some of the Youtube videos and made a few commands based on what i was told from them but i know they are dated and could change at anytime, so the best way to get any up to date help, I thought it would be best just asking the community :grinning:

I am not a confident code user and I feel a little dumb when looking at the Variables page… so I’m really sorry if this all sounds very repetitive for all the staff to see and read… I have tried looking at all the recent topics to find some tips but still felt a little lost in translation… and tried to find some copy paste samples that I could use and I could custom slightly, like to my channels personality but I still wasn’t 100% sure if it was what i was looking for or the complete opposite… :sweat_smile: :sweat_smile:

I have seen nightbot use emotes on other people’s streams but will it/can it use you’re twitch channels personal emotes? And how would you add them ?

I love the 8ball idea , I have seen people use it as is, as just an 8ball or a Magic 8ball, My channels personality isn’t really wizard/magic orientated so I just assume you can call it something else but still get the same 8Ball response?

And I want to welcome new viewers if possible, we try to keep track of people dropping in but while in mid battle for example, where you’re concentrating , someone might pop in but because we haven’t waved or said hello straight away they get upset and leave just before we can, I hate it feeling disconnected during that short time of silence so If there’s a way i can get nightbot to help with that would be really great.

Also would it possible to get some basic common examples?
Like :
$[touser] Is In The chat ! Don’t Forget To Go Check Them Out At https://www.Twitch.tv/$[touser] !

That’s One I copied from a youtube video , but If i could compare them and various others and make sure it’s type correctly, like a spell checker, that would help make me feel a little more confident :sweat_smile:

I want to make sure I use the timers, song request, giveaways and regulars correctly too and if there’s any tips and tricks on making things feel more fun and interactive, I would love to hear it :smiley::smiley::smiley:

Thank you in advance :slight_smile:

Hello @hnb_hurley1!

  1. Nightbot is currently subscribed to a rather large list of popular streamers, and as a result can use their emotes in the chat. Click here to view a list of those channels. If you are an affiliated channel with your own emotes, I do not think Nightbot would be able to use them because it would have to subscribe to you first, and as I recall, Nightbot is only subscribed to partnered channels, not affiliated ones. A workaround would be to add BTTV or FrankerFaceZ emotes to your channel, because any person in your chat, including Nightbot, can use BTTV/FrankerFaceZ emotes.

  2. Of course you can give your 8ball command any name. It will work as long as you keep the command response the same.

  3. If you or your chat moderators are preoccupied while new viewers come to your channel, you can set up Nightbot commands that provide simple responses to common greetings. You can copy and paste the following command into your chat to add it:

!addcom hi Hello $(user)! Welcome to $(channel)'s channel! We hope you enjoy your time here. :slight_smile:

The $(user) variable takes the username of the person who triggered the command and puts it in the response. The $(channel) variable takes the username of the streamer (in this case, your username hnb_hurley1) and puts it in the response. You can change the word “hi” to any other word and keep adding more greetings for Nightbot to respond to, and of course you can change the response to how you see fit.

  1. The example command you wrote is just a little off. Here is how I would fix it. I assume you will use this command to give people in your chat a shout-out, so I called the command !shoutout You can just copy and paste this to add it to your channel:

!addcom !shoutout $(touser) is in the chat! Don’t forget to go check them out at https://twitch.tv/$(touser)

Just in case you are wondering how it works, the $(touser) variable takes a username in your command input and puts it in the response; if no username is specified, it will automatically take the name of the person using the command.

For example: !shoutout hnb_hurley1

Nightbot will say: “hnb_hurley1 is in the chat! Don’t forget to go check them out at https://twitch.tv/hnb_hurley1

  1. In my chat, as well as other channels that I moderate, I have set up a shout-out command that not only gives the link to the specified user’s channel, but also tells what game they are currently or previously streamed. It is a little more complex than the previous one:

!addcom !shoutout Go check out $(twitch $(touser) “{{displayName}} playing {{game}} at {{url}}”) PogChamp

This command uses the $(twitch) and $(touser) variables. The formatted strings, the words surrounded by {{}}, are information about the user’s channel. You can think of it like sub-variables. Whenever the $(twitch) variable is used, it requires a specified username to get information about that user, which is where $(touser) comes in. The message in the quotation marks, including the sub-variables, is what actually shows up in the command response.

For example, let us say you (hnb_hurley1) are streaming Overwatch: !shoutout hnb_hurley1

Nightbot will say: “Go check out hnb_hurley1 playing Overwatch at https://twitch.tv/hnb_hurley1 PogChamp”

PogChamp is just an emote I like to have at the end of the response.

+++

I hope this response helps!

1 Like

@RokettoJanpu

This is Amazing ! Thank you so much! You’ve explained this perfectly for me to understand !

I did think it would be hard to get your own emotes being used if not a partnered channel but that’s fine, il just try using simple emotes for now. That really does clear things up for me a lot more though :slight_smile: Thank you so much ! My Shoutouts are now working great Thank you, Only my Mods can do it which is great too :slight_smile:

I am having an issue with the 8Ball command setup, I was silly and didn’t test it first, and everyone tried to use it when live and i was mortified with myself :worried: I came across the https://docs.nightbot.tv/commands/variables/eval and found a copy paste for 8Ball.

I have renamed it to Odin As we are Viking Enthusiasts and tried to change some of the responses, but i think i broke it :disappointed_relieved:

Could you point out where i went wrong?

You Have Asked Odin To Give Judgement… $(eval const responses = [‘All Signs Say Loki Is In Your Shadow…’, ’My Ravens Say Not a Good Today Day.’, ‘I Am Busy Being Odin… Concentrate and ask again…’, ‘Your Fate Is Tainted, Not So Good…’, ‘Valhalla Will Welcome You!’, ‘Better not tell you.’, ‘It’ll Be An Intense Day, Too Many Valkyries’, ‘Yes! Freyja Smiles Upon You Today!’, ‘It is certain! Thor Watches Over You’, ‘You Remind Me Of My Hounds…Ravenous.’, ‘My Ravens Say Today Is Your Day.’]:wink:

Is it because the responses are too long? or too many responses?

1 Like

That wink wasnt deliberate… did i mess up the ending?

There are two problems:

  • The command is over 500 characters in length, which is Nightbot’s limit
  • There is a ' character in one of your responses ('It'll Be An Intense Day, Too Many Valkyries'). JavaScript strings must be contained by a pair of either ', ", or `. When you use the same character that you used to contain the string, inside the string, you need to escape it with a \, or the string will break.

To solve the first problem, you can upload your responses to pastebin.com like this: https://pastebin.com/raw/H4Zmik7s. The command can download the responses from pastebin using urlfetch whenever it’s used.

To solve the second problem, you can use " to contain your responses.

Here is a working version of the command:

You Have Asked Odin To Give Judgement... $(eval json=decodeURIComponent("$(querystring $(urlfetch json https://pastebin.com/raw/H4Zmik7s))");try{responses=JSON.parse(json);responses[Math.floor(Math.random()*responses.length)]}catch(e){`Failed to parse responses: ${e}: ${json}`.substr(0,400)})
1 Like

I see 3 mistakes in your command response:

  1. Yes, the ending of the response is not properly done. Whenever you are using any variable like $(eval), it is important to start with $(eval and close with )

  2. However, that is not the only issue. I see that “responses” is an array of possible response endings. As with arrays, you need to surround each item with either straight double quotes (“example”) or straight single quotes (‘example’). I believe you tried to use straight single quotes, but ended up typing opening/closing single quotes. Next time you write commands, I suggest typing them on Notepad first, then copying and pasting them into chat, or directly entering them into the Nightbot dashboard.

  3. You have only created the array of responses; you have not actually called for the command to output one of the items in the array. You need to write something in the $(eval) variable that causes it to output a response. For example:

$(eval const responses = [`message 1`,`message 2`,`message 3`]; responses[0])

“responses[0]” is what actually calls for the output of one of the responses. This will cause the $(eval) variable to output the first item of the array of responses, which is “message 1”. Side note: arrays count up from 0, not 1, so 0 corresponds to the first item, 1 corresponds to the second, 2 corresponds to the third, etc.

Since this is akin to an !8ball command, you would probably want the response to be random, so you should use a random number generator when picking which item to output.

  1. Alas, the command response is indeed too long, beyond the 500-character limit. I had to rewrite parts of the response so that the command works.

Anyway, here is the cleaned up version of your command. I apologize if my revision is not what you wanted. Just copy and paste this into chat. I am assuming your !odin command still exists, so this command should just edit the response rather than create/remove commands:

!editcom !odin $(user) Asks Odin For Judgement… $(eval a=[`All Signs Say Loki Is In Your Shadow.`,`My Ravens Say Not a Good Today Day.`,`I Am Busy Being Odin. Concentrate and ask again.`,`Your Fate Is Tainted, Not So Good.`,`Valhalla Will Welcome You!`,`Better not tell you`,`It'll Be An Intense Day, Too Many Valkyries.`,`Yes! Freyja Smiles Upon You Today!`,`It is certain! Thor Watches Over You.`,`You Remind Me Of My Hounds. Ravenous.`,`My Ravens Say Today Is Your Day.`];a[Math.floor(Math.random()*a.length)])

+++

Hope this helps!

1 Like

Alternatively, you can use ehsankia’s quote system CustomAPI to set up a list of responses online that the command can fetch information from. It resolves the need for lots of character space for large arrays, but it takes some setting up beforehand, and I am not sure whether you would have the free time for that. If you do, feel free to click the hyperlink and check it out. Contact me if you need help setting up anything in regards to that.

1 Like

@RokettoJanpu

Thank so much! You have been a huge help! And the cleaned up version , Seriously, Thank you so so much! You have really made things sound much simpler for myself, I really do appreciate it, Thank you <3

1 Like

@RokettoJanpu

Hello again, my odin is not happy :frowning: I keep getting

’ Asks Odin For Judgement… Right-hand side of ‘instanceof’ is not an object ’

I copy and pasted what you had fixed for me .

$(user) Asks Odin For Judgement… $(eval r=[‘All Signs Say Loki Is In Your Shadow.’,‘My Ravens Say Not a Good Today Day.’,‘I Am Busy Being Odin. Try Later.’,‘Your Fate Is Tainted, Not So Good.’,‘Valhalla Will Welcome You!’,‘Better not tell you’,‘It’ll Be An Intense Day, Too Many Valkyries.’,‘Yes! Freyja Smiles Upon You Today!’,‘It is certain! Thor Watches Over You.’,‘You Remind Me Of My Hounds. Ravenous.’,‘My Ravens Say Today Is Your Day.’];r[Math.floor(Math.random()*r.length-1)]) 

am i missing a space ?

I used the aforementioned quote system to make a list of quotes. Once again, just copy and paste this into your chat. It should edit the !odin command:

!editcom !odin $(user) Asks Odin For Judgement... $(urlfetch http://twitch.center/customapi/quote?token=2d1bc8c9&no_id=1)

+++

Hope this helps!

1 Like

@RokettoJanpu Thank you so much! Its flowing beautifully now :smile: Thank you so much :smile:

1 Like

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