Creating your own Twitch chat bot using mIRC

If you're bored or limited by the possibilities of other pre-made Twitch chat bots and want to make your own one, you will be amazed how much you've been missing the whole time. The freedom of scripting and options in mIRC (Program especially created for chat bots) is just overwhelming and in most cases your scripting knowledge will be the only limitation of your bot but this is why this guide was created.


  1. To start off, you will need the program itself which can be downloaded either from the official site or mirrors provided there for free - http://www.mirc.co.uk/get.html                                                          

  2. You will also need another Twitch account to link the bot to. You can name it whatever you want but I would advise adding the "bot" bit at the end so people will know that it's a bot and not a real person chatting. For example "HorusBot".                                                                                                      

  3. When you will successfully install mIRC, launch it and you should get a popup screen which looks like that on the picture. In the "Nickname" box write your bot's account username you created in step 2 and leave all the other boxes blank.                                                                                                     

  4. On the left side of the popup there is a category box, expand "Connect" and click on "Servers" sub-page. You should see a list of original servers available to use but we want to connect to Twitch so click the "Add" Button on the right and a popup should come up like shown on the picture. In description write what you want to call the connection, in my case I just named it like my bot. In the IRC box you will need to exactly put the "irc.twitch.tv" address, leave the port as "6667" and the "Group" box blank. (If the port is blocked by the modem you will need to portforward or contact your internet owner)                                                                                                                           

  5. In the password box you will need to enter your bot account's OAuth key so navigate to this site - http://twitchapps.com/tmi/ and click "Connect with Twitch" button.                                                    

  6. Then copy the whole code provided in the box that starts with "oauth:" and paste it into the "Password" box from step 4, click add, double click on the server you have just added and click ok.   

  7. Now you have successfully set up your bot for use, joining channels and scripting that will be explained in further guides covering different areas. The only thing left to do is to click the connect button that has a lightning icon as shown on the picture connecting your bot to the Twitch server.          



To learn how to use your bot that includes connecting to channels and actually scripting it's behaviour, check out my next guides that are categorised on the right side of the screen.

I hope this guide helped you to set up your own Twitch chat bot using mIRC and if you have any further questions feel free to contact me by e-mail or directly on twitch - "HorusMod".

Nightbot custom commands

Custom commands are both entertainment and help for the viewers. They can contain various channel details and information that the viewers may want to know.

Commands can be added by two methods:


Broadcaster method:

  1. Log into Nightbot website and navigate to the "Custom commands" section.                                        

  2. Click on the "+ Add New Command" button. You should see a pop out menu with settings inside.       

  3. In the "Command Name" box write the command you want to create proceeded by an exclamation mark e.g. "!rules" .                                                                                                                              

  4. Set user access. This will restrict the command to specific user groups. (Keep in mind that your moderators can use all of the commands apart from those you will set to be owner only)                      

  5. Type up a command response. It will be the outcome of using the command.                                        

  6. To finish, click "Add New Command" and your command is ready to be used.                                     


Moderator method:

  • To add a command, write !addcom -ul="user level" !"command" "Response"
  • User levels you can use: mod, reg, owner. And if you want to completely remove the restrictions, just simply delete the -ul="user level" bit.
  • Example of a command: !addcom -ul=mod !test This is a test. - This will add a !test command that is only available for use to mods and the broadcaster with "This is a test" response from nightbot.            


You can include variables in your response to work in various ways, to learn more about them visit this page - http://wiki.nightbot.tv/chat:variables


These are the best two ways to make users aware of your custom commands:
  • Include your nightbot command page in the channel description, mod command or a timer. To make a link, write your channel name after the slash https://www.nightbot.tv/commands/"link" for example https://www.nightbot.tv/commands/motllilknight .
Or
  • If you want all the commands to be visible in the chat instead of a linked page, categorize them in a timer or another command for mods to use in the chat. e.g. !help  Response - !test1 !test2 !test3.

Nightbot song reguest setup

To make the song request option available to your viewers, follow these 4 simple steps:


  1. Log in to Nightbot and navigate to the "Song requests" tab and click on "Manage Song Requests".        

  2. Click on the green "Songs On" button.                                                                                                

  3. Next, go to "AutoDJ" tab that is also in the Songs section. This is now your music source page, do not close it while streaming if you wish the music to continue playing. (Works just like YouTube playlist but is managed by your viewers in real time)                                                                                          

  4. Last step is to adjust the settings like volume to your needs.                                                                     


And all done :) You're all set and ready to go.



Tips:
  • The "Song requests" page is not required to be turned on as AutoDJ automatically receives data from it but can be useful to see the full playlist which will be played.
  • To disable song request simply click the "Songs Off" button.                                                                       


Useful commands:
  • !songs - Explains how to request songs to the users.
  • !songlist - Gives viewers the link to your playlist.
  • !songrequest "link" - Adds your song to the playlist.
  • !currentsong - Tells the viewers what song is playing at the moment.

Nightbot setup

Getting Nightbot to your channel is simple, therefore the fun starts when you have to actually set all the options up.



Setting up:

To start off, go to this website and register using your Twitch username - https://nightbot.tv/                                




Then after you log in, you will be redirected to your dashboard where you can click the "Join" button on the top left corner or simply write this command into your chat:
  • !nightbot join

If you will need to remove him for some reason, then just write this command or click the "Part" button located next to "Join" which will be dimmed.
  • !nightbot remove

You can also make him follow/unfollow your channel by using:
  • !nightbot follow
  • !nightbot unfollow


And all set, Nightbot will be now taking your requests and is ready for setting changes. (spam filter, music etc.)

Getting started with moderation

This guide will introduce you to the Twitch chat moderation world including Nightbot in simple steps and basic commands you will need along the way on becoming the ultimate mod.


First off, be aware that Twitch and Nightbot commands have different beginnings:
  • / - Twitch.
  • ! - Nightbot.

Next, make sure you know the basic original Twitch commands that will allow you to successfully keep order on the channel:
  • /ban username - Bans a user from the channel chat.(Note that this is permanent and will not be lifted until you use the command below /unban)
  • /unban username - If you make a mistake or the user is willing to cooperate, you can simply unban the user with this command.
  • /timeout username - Temporary timeout from chat. Can be also lifted with the /unban command.
  • /clear - Cleans the chat window.

After that, you can start getting to know Nightbot and it's commands that are located on this website: https://nightbot.tv/commands

But to get you started, here are the main commands you will use the most while moderating:

Music commands:
  • !songs - Explains how to request songs to the users.
  • !songrequest link - Adds the song of your choice to the playlist.
  • !songlist - Shows users the link to the current music playlist.
  • !skipsong - Skips current song.
  • !delsong number - Deletes a song from the playlist. (number can be obtained from the playlist using !songlist command)
  • !volume number (1 - 100) - Changes the volume of the music playing.

Regular viewers: (List of people who watch the channel regularly and are immune to nightbot timeouts and restrictions, often managed by the lead editor mod)
  • !reg add username - Adds a user to the list.
  • !reg del username - Removes a user from the list.
  • !reg list - Shows you the list of current channel regulars.

Nightbot spam filter, don't play with options as it's managed by the broadcaster or the lead editor mod.
  • !allow username - If nightbot link spam filter is enabled, you can allow a user to post a link once. (regular users are immune to this filter)


This is all you need to begin, therefore there is one vital thing you need to do before moderating.
Read carefully the rules stated on the channel and ask the broadcaster how strict you have to be.


Hope this guide helped and have fun moderating!