Simple Tutorial: Coding a Twitch Chat Bot in C# using Windows Forms [Part 1]



A kind of long but necessary tutorial on how to code your very own twitch bot!

This video covers the basic framework needed to send and receive commands from Twitch’s IRC server.

Part 2: https://www.youtube.com/watch?v=M414YNXuIcA

Visual Studio 2015: https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx

Oauth generator: https://twitchapps.com/tmi/

source

24 comments

  • Lucas Fransson 3 years ago

    Should the password be the your or the bot's ouath?

    Reply
  • james Dudley 3 years ago

    i think i have the port wrong 10/12/17 irc.chat.twitch.tv ,6667

    Reply
  • MrRobin123 3 years ago

    How do i change the color of the user? For an example : TestBot123: Hello (i want "TestBot123" to be color red and "hello" to be color yellow)

    Reply
  • Jack Black 3 years ago

    thanks! that was a GREAT TUTORIAL!

    Reply
  • Avenston 3 years ago

    Does it work with C# 2010 , because I can't install VisualStudio

    Reply
  • twmanar 3 years ago

    chatBox.Text = chatBox.Text + readData.ToString() + Environment.NewLine; is giving me nullreferenceexception "readData is null" i'm sure that the code is correct so what could be wrong?

    Reply
  • Fundamentals1245 3 years ago

    I keep getting a NullReferenceException error that deals with the — if (readData.Contains("PRIVMSG")) — line and I`m unsure of what to add to make it stop doing that. The bot runs for about 15-20 minutes and then everything just stops and this error just consistently pops up -_- … Any help?

    Reply
  • John Fogarty 3 years ago

    I'm having an odd issue. I have the code done identically to yours, and I get no errors. However, the form refuses to pop up when I run the program. I did every section again and ran it bit by bit, and found out it happens the second I declare the global variables. I did some more, and found out it will still load a basic blank form with all the other global variables declared, except for "IrcClient irc = new IrcClient("irc.chat.twitch.tv", 6667, userName, password);". Once this is declared, it will not load the form anymore when I run it, which I find odd as I am only declaring it here, not even using it. Any thoughts?

    Reply
  • caLLowCreation 3 years ago

    Hi, Nice Vid!
    Twitch is deprecating the API soon, does your code/instructions take this into account? Are you using the newest API?

    Reply
  • Seducier 3 years ago

    I don't think my ping response is working, is something missing? my bot stops after 11 mins.

    Reply
  • BunnyJumps 3 years ago

    How did your Bot got this nice "Bot Icon" are you going onto this in one of your next videos?

    Reply
  • Anthaeus3216 3 years ago

    Awesome start to the series, I now have a working irc client for my twitch bot. Hope the rest of them are as useful 🙂

    Reply
  • Seducier 3 years ago

    Everything worked fine for me up until I tried to chat from twitch and it didn't get the message. I read all the comments and still can't figure out what I missed. Good tutorial, and thank you.

    Reply
  • Fatih Toprakkale 3 years ago

    :tmi.twitch.tv NOTICE * :Login authentication failed ????

    Reply
  • VariantRobert 3 years ago

    I'm getting two warnings:
    "Field 'IrcClient.userName' is never assigned to, and will always have its default value null" which points me to the "private string userName;" in "class IrcClient"
    and
    "The variable 'e' is declared but never used" which points to the "Exception e"

    When I start it up It's just a blank window

    http://pastebin.com/bELT6q06

    Reply
  • Сергей Жуков 3 years ago

    Hello. thank you for video.
    1. Where can I fine source code from video?
    2. Can I read the messages from chat as anonym? I head that I can use useranme like "justforfun23423"

    Reply
  • Daniel Pedersen 3 years ago

    How do you make: passwordhidden? 17:54

    Reply
  • Kjeld Jense 3 years ago

    i i type anything in my twitch chat, its not apearing in my chat in that form1. i i typed everything good http://hastebin.com/winubapowo.cs Whelp FeelsBadMan

    Reply
  • Hudson 3 years ago

    Explain to me why I have this? Like WTF. I followed everything…. https://gyazo.com/97e2695cb1a6d0b438de041897a5ad57

    Reply
  • Oscar LajeGaard 3 years ago

    Mine is totally fucked ? http://imgur.com/a/PnSJo
    i used everything correctly no errors and nothing

    http://hastebin.com/jizaqanewu.cs

    Reply
  • Miraliskiller 3 years ago

    best programming video i ever saw!!!
    like subbed and thank you very much for this tutorials this helps me so muuuuuuch!!¨<<<<<<<<<<<3333333333

    Reply
  • Jan Vlot 3 years ago

    i have a Problem the bot starts and join but it cant read or write in the Chat 🙁

    Reply
  • dewdrinker19 3 years ago

    I'm getting sometimes getting an error when trying to close the bot. It highlights the Environment.Exit(0); line and says Win32Exception was unhandled.

    Does anybody have any ideas at why this could be?

    Reply
  • Oscar LajeGaard 3 years ago

    my one comes with this error

    Severity Code Description Project File Line Suppression State
    Error CS0029 Cannot implicitly convert type 'string' to 'System.Windows.Forms.RichTextBox' Bot for twitch 73 Active

    Reply

Add your comment

Your email address will not be published.