In the second part of our series on setting up a chat bot for your stream I’ll be showing you how to set up custom chat commands in Nightbot so you can create useful shortcuts to in depth information about a game, create shout-outs for other streamers in your chat, link to your other social media and more.
If you read the first part of this series you may have noticed that the default commands that Nightbot includes are missing some staple command types that are used extensively across Twitch so we’re going to create them now using the Custom Commands tool in Nightbot.
Custom commands can be really powerful as Nightbot allows you to use a number of variables but today we’re going to focus on creating a link to our Discord Server, a message with a counter on it and a Shout Out command.
Creating A Custom Command
Step 1
To create a custom command log in to NightBot then click on Commands then Custom in the left hand menu. This will take you to https://nightbot.tv/commands/custom then click on the blue “Add Command” button.
Step 2
First we’re going to choose what we want the command to be. It’s an accepted standard that commands tend to start with an exclamation mark so it’s clear to users that they are using a command and so the command isn’t accidentally triggered by a viewer happening to have the command name in a message they’ve typed. That being said you don’t have to follow this standard and sometimes you may want to create a “secret” command that will happen during the normal course of chat. For our first command we’re linking to our Community Discord server so we’re going to use !discord as the trigger.
Step 3
Next we’re going to write the message that Nightbot will respond with. For our Discord command we’re going to write:
Join our Community Discord to keep up to date with the stream, socialise with our awesome community and more at https://discord.gg/imaflanker – Don’t forget to let us know if your Discord and Twitch usernames are different so we know who you are.
Step 4
Now we’re going to choose who can trigger this message. There are certain message type that you may only want you or your moderators to be able to trigger, or you may have subscriber only commands.
If you restrict who can use the command if someone that doesn’t have permissions tries to use it NightBot will just ignore the request and nothing will happen.
In our case we want everyone to be able to find their way to our Discord community so we’re going to set the command to allow “Everyone” to use it.
Step 5
Next we’re going to choose our Cooldown length, this allows you to set a minimum period before the same command can be used again anywhere from five seconds to five minutes. If someone tries to use a command while it’s on cool down NightBot will just ignore it.
For our Discord command we’re going to leave it at the minimum five seconds.
Step 6
The final option we have is to set an Alias, this is only used if we want one command to trigger another command as part of its response.
For our Discord command we’re going to leave this blank as we don’t need NightBot to call another command.
Now we’re going to click submit and our command is ready to use.
Step 7
Finally we’re going to test our command works on Twitch, you don’t have to be online to test your commands just go to your Twitch channel and select chat and type in your command.
If you want to see the commands we’ve added in this guide in action on my channel head to https://www.twitch.tv/imaflanker/ and you’ll be able to test them yourself.
More Commands
Creating the rest of our commands all use the exact same steps, to make it easier I’ve included the commands along with the text I’ve used for each command below.
Shout Out Command
One of my most used commands is the shout out command that promotes other streamers from our awesome community that pop by my stream. My view is that if I’m not playing a game that my viewers are interested in or if I’m offline I’d love those viewers to have a great time in another stream that they will enjoy from our community.
This looks more complex than it is in the message as it’s using some variables. I’ve set this command to be able to be used by VIP members or above but you may want to set it to only be used by you or your moderators.
Command | Message | Cooldown | User Level |
!so | $(twitch $(touser) “Give {{displayName}} a follow at {{url}} they were last playing {{game}}”) | 5 Seconds | VIP |
To use this command you type the command in chat followed by a space then the username of the Twitch streamer you want to shout out. For example: !so fgsquared or !so @fgsquared will display the following message in chat.
“Give FGsquared a follow at https://www.twitch.tv/fgsquared they were last playing Struggling“
The reason you might use an @ at the beginning of the username you want to shout out is that it allows you to look up a user in chat that’s typed a message and can make it a little faster to type your command.
Counter Command
Another handy command is a counter command, this allows you to create a counter to count the number of times the command has been used, this can be useful for tracking deaths in a game or in my case, how many times I’m being blamed for something by chat. To get this to work we’re using the Count variable $(count) which counts how many times the command has been used.
Command | Message | Cooldown | User Level |
!bflanker | Yes… this is Imaflanker’s fault and it has been $(count) times so far… and there are many, many more derps to come we’re sure. | 5 Seconds | Everyone |
In my case I’m blamed a lot (probably deserved) so using this command displays the message:
Yes… this is Imaflanker’s fault and it has been 295 times so far… and there are many, many more derps to come we’re sure.
The 295 I’ve highlighted is the $(count) variable and will increase by one each time we use the command.
Uptime Command
This up time command allows users to see how long you’ve been live for by writing !uptime in the chat. This use a few different Command Variables for Twitch.
Command | Message | Cooldown | User Level |
!uptime | $(twitch $(channel) “{{uptimeLength}}”) | 5 Seconds | Everyone |
Using this command if your channel is offline it will display how long you’ve been offline for while tagging the person who triggered the command, for example if I trigger the command it will respond with:
@Imaflanker, imaflanker has been offline for 11 hours 27 mins
If you’re online then it will respond with the same message but how long you’ve been streaming for, for example:
@Imaflanker, imaflanker has been streaming for 15 secs
Want to know more?
I hope you’ve found this guide to creating Custom Commands in Nightbot useful useful. I’ll be creating more of these guides with step by step instructions on how to add timers to customise Nightbot as well as taking a look at other options for bots over the next few posts but if you have a question you need an answer to just head over to our awesome Discord Community at https://discord.gg/imaflanker and ask away in our Social Channel and I’ll be happy to help and give you access to our Streaming Chat channels.
You can also check out my previous post on Setting Up A Chat Bot For Your Stream