paint-brush
Make A Retro Chatbot For IRCby@enfors
1,522 reads
1,522 reads

Make A Retro Chatbot For IRC

by Christer EnforsOctober 29th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Ever since I started making software for the Internet back in 1995, I’ve been fascinated by chatbots — programs that attempt to chat with humans, as if they too were human. Back in 1995, however, chatbots typically weren’t the conversational kind, they more commonly acted as automated administrators. They were frequently employed on IRC (Internet Relay Chat) to keep channels clean of spammers, and other such tasks. If you’re new to IRC (or haven’t used it in a while), I recommend you read <a href="https://medium.com/the-complete-guide-for-irc-network-i-e-freenode/irc-introduction-and-its-main-ingredients-982cd3639a67" target="_blank">this excellent Medium article by Baseer Hussain</a> to get up and running.

Company Mentioned

Mention Thumbnail
featured image - Make A Retro Chatbot For IRC
Christer Enfors HackerNoon profile picture

Ever since I started making software for the Internet back in 1995, I’ve been fascinated by chatbots — programs that attempt to chat with humans, as if they too were human. Back in 1995, however, chatbots typically weren’t the conversational kind, they more commonly acted as automated administrators. They were frequently employed on IRC (Internet Relay Chat) to keep channels clean of spammers, and other such tasks. If you’re new to IRC (or haven’t used it in a while), I recommend you read this excellent Medium article by Baseer Hussain to get up and running.

Today, I will show you how to make a simple IRC bot in Python 3, which you can then extend to do whatever you want. I’ve developed and tested it on Linux, but it should run without any major problems on other operating systems as well.

Before we do anything else, you’re going to need to install my IRC bot framework called “BotyMcBotface”. This is most easily done with pip:

$ pip3 install --user botymcbotface

Now that you have BotyMcBotface in place, it’s time to write the actual code for your bot. Type in (or copy and paste, who am I to judge) the following code in a file called, for example, my_bot.py (if you’re having trouble copying and pasting it, try going here and trying instead):

As you can see, the bot welcomes me when I join its channel — it’s working!

If you want, you could get a copy of the BotyMcBotface framework itself, from GitHub:

$ git clone https://www.github.com/enfors/botymcbotface.git

If you make an interesting bot, I’d love to include it as another example on GitHub, giving you full credit for it, of course. Feel free to poke around in the code. Perhaps add some features of your own?

If you enjoyed this article, follow me on Twitter. Or better yet, follow me on Mastodon.