Creating a Chat Bot for use in Twtich

Hello friends, my name is Randy M and I am the creator of a bot called Exubot. I am not looking to make him open source but I have decided this would be a good way to help teach myself coding. Anyway, I have been lurking around the internet and I can’t seem to find any resources that help code a bot that is for use in twtich, and are updated. The most recent one I have come across would have to be a youtuber who is a series and used this code for Link Deletion.

on @*:text:*:#:linkpost $1-
on @*:action:*:#:linkpost $1-
on @*:notice:*:#:linkpost $1-
alias -l linkpost {
  if ((!%p) && (!$hfind(permit,$nick))) { inc -u4 %p
    var %purge /^!(link\so(n|ff)|(permit))\b/iS
    var %domain com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk
    var %link /(?<=^|\s)((?>\S{3,8}:\/\/|w{3}\56)\S+)|\56( $+ %domain $+ )\b/iS
    if ($findtok(%chanon1,#,1,32)) && ($nick(#,$nick,vr)) && ($regex($1-,%link)) {
      timeout # $nick | /mode # -b $nick
      msg # $nick You did not have permission to post a link ask a mod to !permit you
      msg # /timeout $nick 1
    }
    elseif (($regex($1-,%purge)) && ($regml(1) = permit) && ($nick isop #) && ($$2 ison #)) {
      hadd -mz permit $v1 30 | notice $v1 You have 30 seconds to post a link. Starting now!
      msg # You now have 30 seconds to post a link!
    }
    elseif (($regml(1) = link on) && ($nick isop #)) {
      goto $iif(!$istok(%chanon1,#,32),a,b) | :a | set %chanon1 $addtok(%chanon,#,32)
      .msg # My Link Protection Is Now on in: $+($chr(2),#)
      halt | :b | .msg # $nick $+ , my link protection is already on in $&
        $+($chr(2),#,$chr(2)) !
    }
    elseif (($regml(1) = link off) && ($nick isop #)) {
      goto $iif($istok(%chanon1,#,32),c,d) | :c | set %chanon1 $remtok(%chanon,#,1,32)
      .msg # My Link Protection Is Now off in: $+($chr(2),#)
      halt | :d | .msg # $nick $+ , My link protection is already off . $&
        !
    }
  }
}

Although, the code is out of date and doesn’t seem to work with twitch anymore, I am not the only one as others in the comment of the video have said this as well. If someone who isn’t too busy, if you could contact me and help me code this script, give me pointers or maybe show me an open source universal script for a chat bot that already works with Twtich that I could modify. I would be more than happy to implement a command to and in general shout you out for the help or if money is your game, than pay you.

Thank you in advance,
Randy.

I am still waiting for that YouTuber to add Raffle system.

I am looking to try and create and entire ChatBot much like NightBot and Moobot but instead of keeping it a secret post the script online and make it totally opensource so all coders can access it and update it, fix the script and add to it. Hopefully one day having a free script better than Nightbot so anyone can make a bot and customize it more than ever. Unfotanutly I am not that good of a scripter so I am looking for help on the script, meanwhile I am still taking courses at the local university. If I can’t find anyone to help hopefully I will be able to do a complete mockup and post it on my website or other scripting forums online. I am thinking about starting a Reddit Forum about it and getting the community to help build it.

If you’re learning code, I suggest going with Java. It’s very easy to pick up and there’s a lot of features within the language.

Implementing a IRC bot in Java is really easy. There’s a framework called PircBot which does the whole IRC part of the bot - you just need to code the actions for it (bans, messages, etc.).

I’d really recommend taking that up instead - but if you’re just starting out, try something a bit simpler than going straight at the bot.

PircBot is really good for these kinds of purpouses for a beginner, I’ve tried it on multiple occasions though, and id suggest you really do learn Java first, before jumping into something like this. Especially, go over things related to writing/reading from files, because you do need to store the channels and functions in them, that you operate on, somewhere.

After looking through that snipit of code there are a few things that you need for it to work.

It calls an alias “timeout” but it isn’t defined… You’ll need to write it. It’s simple enough and should look like:

alias timeout {
msg $1 /timeout $2
}

also it uses a hash table called “permit” to see if a user is permitted to post a link so you’ll need to create one before using that script.

I have been doing something similar, except I found some references…

https://github.com/SupremoRTD/LoyaltyBot
http [colon slash slash]sourceforge.net/projects/twitchmodbot/

LoyaltyBot being the much better code base (Though it is in node.js and can be a bit difficult to read if you are just learning to program. If you do reference ModBot, please understand the code quality is crap, and that it has tons of errors.

  • Monk

Edit: Apparently I can only post one link as I am a new user, sorry about the 2nd link needing some editing to follow.

i personally dont know how to make chat bots for twitch but i do know someone on twitch who does and might be willing to teach you how to make a chat bot yourself. he made a chat bot for a twitch streamer named Cohh Carnage called the Cohhilition bot. his name on twitch is rodr1c.

Can you link the channel of the person whom created the bot?

His channel can be found here. If you’re fine with looking at node code, @glacials also has an open-sourced bot here.

Given you just necro’ed a post that six years old… probably not…

You should check the documentation for updated advice and protocols

1 Like