How to Build a Twitch Bot Using TMI.JS (a moderator bot).



Let’s build a bot! Not a bad bot like a view bot, but bot for good. Let’s build a Twitch moderator bot using tmi.js! The Twitch API is powerful and and already has lots of great bots however no bot has the flexibility of creating your own! In this video I will show you how to build a Twitch bot using TMI.JS from start to finish. You’ll see how to use the developer portal, set up oauth, set the correct scopes, get an access token, create a bot using JavaScript, NodeJS, and NPM, invite the bot to your Twitch channel, and have it moderate your chat. Also, We have made this bot open source and will continue to contribute to this bot.

———————————————————————————–

If you need help cloning this repo, or setting up your developer machine, see my other video:

GitHub Repo https://github.com/techno-tim/techno-boto-twitch

★ Subscribe! https://bit.ly/techno-tim-subscribe
★ I’m Live Every Tues/Thurs/Sat on Twitch https://www.twitch.tv/TechnoTim
★ Join our Full Stack Discord Community! https://discord.gg/DJKexrJ
★ Documentation found here https://github.com/techno-tim/youtube-videos#Topics

00:00 – Intro
00:19 – Why
00:56 – Prerequisites
01:16 – Twitch Developer Site
02:08 – Bootstrap Our App
05:59 – Install tmi.js
07:21 – Start the App
07:50 – OAuth Token
10:37 – Start Bot with Auth
10:57 – Code Cleanup
13:37 – !hello command
13:47 – Moderator Code
20:32 – DO NOT DO THIS
22:39 – Testing the App
22:59 – Made the Bot Open Source
__________________________________________

🔔 Social Media 🔔
► Twitch https://www.twitch.tv/TechnoTim
► Twitter https://twitter.com/TechnoTimLive
► Discord https://discord.gg/DJKexrJ
► Instagram https://www.instagram.com/techno.tim/
► Facebook https://www.facebook.com/TechnoTimLive/
► GitHub https://github.com/timothystewart6
__________________________________________

► Techno Tim Amazon Store:
https://www.amazon.com/shop/technotim

Techno Tim Kits:
► 4K YouTube Kit: https://kit.co/TechnoTim/4k-youtube-kit
► Pro Level Live Streaming Kit: https://kit.co/TechnoTim/pro-level-live-streaming-kit
► Budget Gaming Streaming PC 2020: https://kit.co/TechnoTim/budget-gaming-streaming-pc-2020
► Performance Virtualization Server: https://kit.co/TechnoTim/performance-virtualization-nas-server
► Budget NAS Server: https://kit.co/TechnoTim/budget-nas-server
► Coding & Gaming Keyboards: https://kit.co/TechnoTim/coding-gaming-keyboards
► Coding & Gaming Mice: https://kit.co/TechnoTim/coding-gaming-mice

This description contains affiliate links. If you click on one of them, I’ll receive a small commission at no cost to you. Thank you.
____________________________

⏯ Recommended Videos ⏯
► 20 Ways to Use a Virtual Machine (and other ideas for your homelab) https://www.youtube.com/watch?v=SVQmzaSabEQ
► Remote Gaming with Promox https://www.youtube.com/watch?v=fgx3NMk6F54
► Let’s Build a Discord Bot Using DiscordJS – Moderator Bot https://www.youtube.com/watch?v=YSZcyz2-twQ
____________________________
#tmijs #TwitchBot #TechnoTim #OpenSource #twitch #TwitchDeveloper

Description Tags: Techno Tim, technotim, tmijs, tmi.js, create a chat bot, twitch chat bot, twitch api development, software engineering, software engineer, twitch gaming api, twitch chatting bot, twitch robot, twtch moderator channel, moderators, help your moderators, how to build a twitch bot.

Thank you for watching!

source

38 comments

  • Techno Tim 3 months ago

    Which bot do you use in your twitch chat?

    BTW, if you're new here welcome! Subscribe for more content like this! ✨

  • AoXNeR 3 months ago

    great vid, quick question, as of today the request to the process has changed. now you require a code to get a token, but the code is valid for only one use (run). do i have to keep generating codes for the bot to run? how do u make it automatic (getting the new code from get request, they don't give it back)
    hope u could understand…

  • David Lisle 3 months ago

    I can not seem to get Yarn to work on my VS code

  • White Rabbit2 3 months ago

    where is the doc in github?

  • Bruno Gonçalves 3 months ago

    Man, thank you SO MUCH! I had several doubts on authorizing my bot without issues, but your video clarified my ideas and made it so much easier, thanks to you, my exercise bot can work properly! Although I didn't quite managed to change the bot's name on the chat. How do I do that?

  • Drackrath 3 months ago

    For everyone working with a different Editor. Just go into Webstorm or anything else and use "npm" instead of "yarn" for all procedures.

  • Awsomebudderbro gaming 3 months ago

    Hey I am new to this kind of thing and I am trying to figure out how to get a terminal or a GUI. Any help will be appreciated. I can't join the discord because I am already full on servers I believe.

  • xHeaveny 3 months ago

    You got a new subscriber 🙂

  • Will 3 months ago

    I have a question. If I have my bot hosted on Glitch, what would the OAuth redirect URL be? Thanks

  • e2r0r 3 months ago

    Thats amazing! Thanks!

  • Wasied 3 months ago

    thanks a lot

  • OfficialRDB 3 months ago

    Hey great via. I made it so it always logs the messages to a discord channel.
    Is there a way that i can talk inside my discord to sends the message towards twitch chat ?

  • GwnDoggo 3 months ago

    your code is so messy

  • Fevzi Çakmak 3 months ago

    Thx for guide. I have a question. Blocked words not specified. Example: cats or asdacats comments are deleted. How to specified the words ?

  • BloatedNikNak 3 months ago

    I noticed that at 19:43 you added
    "if (userstate.username === BOT_USERNAME) return;"
    this code is not needed, and will never be executed, as the line above that does exactly this.
    "if (self) return;"

  • Anthony Sistilli 3 months ago

    Great video man!

  • Promote Streams 3 months ago

    Hey dude
    How did you set up tthe !hostme command on your twitch account

  • linkygirl7200 3 months ago

    yarn add esm didnt work for me….. idk what to do

  • Ask94 3 months ago

    Hey just using you'r preconfig, its great!
    Its interesting for me because i hadnt written before in Java / Node.js

    Just have a Question.
    Is there a way to auto-update if i put in a new message command? Or do i need to restart the app every time ?

  • Jonathan 3 months ago

    Nice video, it was very helpful an informative just when I'm starting to get interested in custom twitch bots! I am fairly new when it comes to coding and stuff, I was wondering if there was a way to make a bot so you can do something like !timeout600=test as a command to do a 10m timeout for anyone that says the word "test" and maybe something like !timeoutreset to reset the command so that no one else will be timed out for saying "test"? I'm not sure if that is possible, but it would be helpful especially when dealing with twitch chat spam bots.

  • ShadowJuve 3 months ago

    THANK YOU SO MUCH!

  • Digital 3 months ago

    You should vid on how to make custom commands for your twitch bot. @Techno Tim

  • Digital 3 months ago

    Hello, the oauth2 isnt working is there another website to go to??

  • Digital 3 months ago

    Hello, The Yarn add esm didn't work it said there was a error

  • Tybn 3 months ago

    do you have a problem where the bot requires authentication and then reads and replys to everything twice

  • Slepyps 3 months ago

    Hey! I'm having a problem. Every time I send a message, it filters it, no matter what is said. Can you help out?

  • harveydotdotdot 3 months ago

    Since adding delete functionality I get an error everytime I send a message on the chat. I understand I wont be messaging my chat all the time but I dont want the app to fall over whenever I do any help?

  • Arif Mitha 3 months ago

    This video is awesome, and overall your channel is great. You earned yourself a sub.

  • dogdaytv 3 months ago

    Amazing. Was starting to plan out writing a Twitch bot for learning purposes and this video appeared. High quality, thorough and overall very comprehensive. Thanks!

  • Naig Carillo 3 months ago

    Hey! Can you by any chance deploy this on heroku and make a video of it? Would definitely help. Much appreciation on this tutorial.

  • mrPlus 3 months ago

    Good tutorial 😉

  • Markus Meier 3 months ago

    it's a good tutorial, i just have one question, is there any way the bot will run even when the computer is turned off.

  • Tobi 3 months ago

    Please make a !addcom tutorial!!!

  • JoshyPlays 3 months ago

    Thanks! finally i found an up to date tutorial!

  • Rodrigo Gil 3 months ago

    hey is it possible to make it auto asnwering with the browser snippet? like "!blah" and it says "blah blah blah"?
    (total noob)

  • Stepqen Live 3 months ago

    Everytime i start the bot i get an error of `No response from Twitch.` anyone know why

  • FollowSonik 3 months ago

    Johnny Dep is coding.. Now I saw everything!

  • Raj Shrishrimal 3 months ago

    Superb video 💥🎉

Comments are closed.