18 ms·
How to write an IRC bot
- grokkingStuff 9y agoAs much as I like IRC, I don't get why the author hates slack so much. I dislike slack (probably because of the culture in Slack groups) but I do think that having a mobile app & ease of use is why Slack is okay. Not having to deal with different servers & terminology that look scary also helps (a lot) for most people using Slack. Most people who use Slack haven't ever used IRC professionally (or at all) - I've shown IRC to people who love Slack and I usually get "Ugh, it looks so old fashioned and difficult to use" as a reaction. Looks matters a lot if you want people to use it - most IRC clients are old or have designs based on old clients. Plenty of Slack clones out there that look decent that have similar business models. What would be awesome if there's an IRC server that looked and acted like Slack; nice features like: - a website to log into like Slack (with benefits like modern web design and Github, Twitter, Facebook login). - an irc client that looks decent on website, desktop and phone clients (and doesn't run on electron). - having multiple channels for one company like Slack channels in a group. IRC currently requires you to register several channels (which is annoying). ------------ As for the difficulty in writing bots for Slack vs IRC, sure it's easier to write stuff for Slack because: - most Slack bots/services are written by companies who want their third party services to be easily integrated into whatever team communication their client use. - most custom bots are variation of some bots that someone else has written (anecdotal evidence but pretty sure it's true). I'm pretty sure it's not that different for irc. - most people don't bother writing bots unless they're willing to play around with bots; difficulty isn't an issue when it comes to writing one and I haven't seen bot development treated as an actual task (it's more of a hack that works and isn't really touched again.) ------------ Honestly, this seems to be a case where the author neglects how real-life people work in favor of code "niceness" (for lack of a better term). There's a reason why most people use Microsoft products (and it isn't because they make great software.)
- llao 9y ago> I don't get why the author hates slack so much. He gives a nice reasoning in the last paragraph: Slack is a walled garden. Their proprietary API is defined by them and only implemented by them. They can and will shut off parts you depend on (like the IRC+XMPP gateways that were just shut down).
- nickez 9y ago> Their proprietary API is defined by them and only implemented by them. Is this really true though? Doesn't Mattermost have a slack-ish-compatible interface?
- llao 9y agoWell, others can try to implement parts of it but it is a cat and mouse game of wasting human resources. Mattermost managed to get some compatibility https://docs.mattermost.com/developer/webhooks-incoming.html#slack-compatibility https://docs.mattermost.com/developer/webhooks-incoming.html...
- SlowBro 9y agoWhat’s the nicest looking IRC client these days? I lately only ever use any chat client sporadically so I’m out of touch, but may be needing a platform soon. Interesting note: I worked at AOL when AIM was introduced and was one of the first users :-P When I moved to tech support of a local cable internet company that was our official work chat :-)
- mattcoles 9y agoIf you have a Mac, Textual is a great IRC client although their upgrade policy is a bit frustrating, in that upgrades don't seem to be free for life, only discounted.
- madeofpalk 9y ago'Great' is relative. Textual (and Colloquy) are tolerable at best.
- kough 9y agoI use Limechat on OSX and Hexchat on Windows and am mildly dissatisfied with both.
- elsurudo 9y agoI already commented on this, but have you tried Colloquy for Mac? http://colloquy.info http://colloquy.info
- croon 9y agoAs someone who's been on irc since the mid 90s and have had and still do have a couple of Irssis running in screens for 10+ years, I have to say that irccloud is pretty great for ease of use. There was an open source clone called ircanywhere, but it seems abandoned. I have no idea what the future holds, and I always welcome new tools and disruptions, and I'm using slack, discord, messenger etc for various communities. What keeps me from leaving irc is: * friction in moving all users that have been using an IRC channel for 20 years * stupid stuff in slack and messenger like lock in and slow search. I really like grep:ing logs for links and discussions and then reading the context up and down, which I have found difficult in web services.
- Jaruzel 9y ago> I've shown IRC to people who love Slack and I usually get "Ugh, it looks so old fashioned and difficult to use" as a reaction. This is the exact reason why I don't like Slack - It takes up WAY too much screen estate. At least with IRC I can format it in a way that I prefer, AND be able to use the rest of my screen for other tasks.
- simias 9y agoSlack and Discord (which seem to be the "hype" chats these days) are pigs both in terms of real estate and resource usage. I can easily see a backlog of nearly a hundred messages in a single terminal IRC frame but I'm lucky if I can see 10 messages in Slack or Discord. So much scrolling to catch up with chat history, not to mention how laggy it feels if you don't have a high end PC. I can't easily script the client, I can't easily self-host and script the server and I'm stuck with a proprietary architecture at the whims of the devs. Amazing. You'll have to pry irssi out of my cold dead hands.
- nopacience 9y agoMost people who use Slack haven't ever used IRC professionally (or at all) - I've shown IRC to people who love Slack and I usually get "Ugh, it looks so old fashioned and difficult to use" as a reaction. Probably the same people that never used a terminal and have the same reaction at first. And then you teach them a thing or two, let them evolve and weeks later when you less expect it, that same person is thriving on the terminal he hated initially. I have seen this happen a couple times... windows people saying linux is awkward. or even that i3-wm is awkward, until they get to learn it and they completely change their mind. Slack has its merits, but plain IRC also works fine. The same people that prefer slack because they never really tried IRC, might say they prefer slack because it allows them to write BOTs. BOTs in irc is easy, there are 3 kind of bots: - bots that interact: User types something in a channel or via private message. The bot will receive that message and the user that typed it. then it will parse the message and take an action. Examples of interaction messages: -- msg to bot: google this: "time now ?" (then the bot connects to google and makes a query and replies to this message): UTC 10h20 -- msg to bot: reboot - bots that say stuff: You are on a chatroom and then all of a sudden a bot joins and says something ie. "Your new website has been updated". OR, "Someone made a pullrequest on github, please somebody go there and accept it" - a mix of those 2: the bot will say stuff and also accept/interact commands IRC is really simple. The bot simply reads text and takes action. Or, just take action and talk on the channel. Its completely diffrent from slack bots because it is simpler it will not need the programmer to set up a WEB SERVER in order to receive messages from slack. Seriously.. the bot should connect there just like the user does and read messages, parse and take action. Long live IRC =) BOTs that say stuff works this way: You are on a channel and then all of a sudden a BOT joins and says: "The new release of your website has been successfully updated"
- yoz-y 9y agoWell, you can set up a web server using netcat too. Just recently there was an article on HN doing basically that. However Slack does require HTTPS which complicates things, but is also quite a must in current day and age.
- yoz-y 9y ago> And then you teach them a thing or two, let them evolve and weeks later when you less expect it, that same person is thriving on the terminal he hated initially. I have seen this happen a couple times... windows people saying linux is awkward. or even that i3-wm is awkward, until they get to learn it and they completely change their mind. Usually I have met two kinds of people. Those who do not need any motivation to learn new things about computers. And those who will just flat out refuse to learn anything that remotely does not look like what they are already accustomed to.
- eximius 9y agoSlack is literally worse than XMPP or IRC at most things. The only improvement that Slack has is newer UI and you can bill someone to manage it on your company's behalf instead of paying someone in house.
- chukye 9y agoso cool read IRC Bot in HN front page. I remember when I started to program, hacking irc scripts for fun, thanks for the post, remembers me good times. (RIP t7ds)
- caioariede 9y agomIRC scripts is what you meant, right? That's basically how I started in programming. One of the things that certainly contributed for keeping my interest in programming was the quick feedback. No need for confusing setups, just open the editor and start doing something. I know a lot of people that started this way and are good programmers nowadays.
- avemg 9y agoCan't speak for OP, but my progression went like this starting in 1995: - Start wasting lots of time in MSN chatrooms - Parents cancel MSN and switch to local ISP. Mourn loss of chatrooms. - Discover IRC using the mIRC client - Start playing around with mIRC scripting - Get into Linux because that's what the crowd I hung out with on IRC was using - Switch to epic and BitchX and start scripting on this clients - Get into eggdrops and start scripting those and then start looking through the actual source code and making changes - Start writing my own bots Amazing how much my current career as a software dev is owed to things I learned because I liked "wasting" time chatting online.
- runeb 9y agoNostalgic read! Same here, '96. Then getting into irc wars, net splits and nickname collisions, taking over channels. Finding bugs in eggdrop 1.1.5 to gain op on channels. Never did work with TCL again though.
- rogy 9y agoSame, I wrote a bunch of mIRC scripts then my dad kept switching the family PC off and they weren't useful anymore. So i learned to make IRC bots in PHP. what a time.
- aluhut 9y agoI wish someone would pick up megahal and bring it up to date.
- crispyporkbites 9y agoIn summary to write an IRC bot, open a TCP socket to an IRC server in whatever language you want and start doing stuff. To write a slack bot, go jump through their hoops and proprietary tech, and maybe they'll let you do stuff. Thank goodness the web and email are open protocols, let's hope in 10 years time we have added a standard chat protocol to that list, and no one is wasting time on proprietary chat platforms.
- LambdaComplex 9y agoXMPP?
- crispyporkbites 9y agoMy mum knows what a website is, and she knows what an email address is. She doesn't know what XMPP is. When she knows what XMPP is (or a competing federated protocol), chat is solved.
- bhhaskin 9y agoDoes she know what instant messaging is? What you listed are not the protocols themselves. The trick is just to make XMPP the standard way to do IM.
- DontSueMeBro 9y agoDoes she know what HTTP or IMAP are?
- braderhart 9y agoDoes your mum use Mac or Windows?? That could be part of the problem.
- resonanttoe 9y agoGiven that you're describing your Mum in the same fashion we typically all do (And to avoid the "Yes, she's actually very technical" bait-n-switch), we'll assume no. You're mixing the ubiquity and common parlance/popularity to suit your situation, but it doesn't work that way. FTP, IRC, HTTP, and SMTP are all ubiquitious, but not necessarily the most popular method for describing things, keeping in mind that we haven't fully shut the book on the internet == www. XMPP is the protocol that you're talking about here but you shifted gears midway through to say that she should know what instant messaging is. (which again, I'm gunna guess she does). Similarly, Email fetching itself has gone through one major protocol shift under her nose without changing the very nature of it, so to make claims that in the particular instance of messaging she should know the protocol is arbitrarily moving the rule-bar. (Bet you still have to try and explain the difference between http and https to her too, and that always ends with *sigh... just look for the little green lock. :P)
- jachee 9y agoAlternately: http://zork.net/~nick/shazbot/README.html http://zork.net/~nick/shazbot/README.html
- pavel_lishin 9y agoI'm always very impressed by people who can write awesome things in bash.
- askz 9y agoRIP Eggdrops
- dmitriid 9y ago- 80% of the article: complaining about Slack - 20% of the article: pretending to write a bot (and never actually writing a bot) that does about 1% of what a bot on Slack can do Article title: "How to write an IRC bot" I've personally written a (admittedly crappy) four-way integration between Slack, IRC, XMPP, and Telegram [1]. IRC and XMPP are consistently the worst protocols to write for if you want anything but plain text. And believe you me, people do want something besides plain text. And don't get me started on clients for those :) Funnily enough, irccloud is basically trying to do what Slack is doing, only with IRC: a web-based interface, with private channels, embedded media, etc. The only way to ,enjoy all that is to use the web-based clients, etc. [1] https://github.com/dmitriid/tetrad https://github.com/dmitriid/tetrad
- nopacience 9y agoSeriously? What did you expect? The secret sauce is on the client. For example, user pastes in plain text, a youtube url: userXXX: http://youtube.com/cool-video http://youtube.com/cool-video Then lets say user2 client reads that message, then it will parse it and check if youtube.com has a plugin enabled. If it does, it will get the thumnail and title and display it in a nicer way than just the URL. But it was initially just a url. I think you want a HTML chat with javascript. Try making that... and discover that it is not secure to accept and run javascript from unkown users. So plain text means securer! -- without code that might be evalled.
- dmitriid 9y agoI see you've never used Slack before. Slack doesn't run a "youtube plugin javascript". It does link unfurling [1]. Precisely for this reason: "it is not secure to accept and run javascript from unkown users.". And, of course, it supports unfurling for a lot of things out of the box: links, images, youtube and vimeo videos, spotify playlists etc. That is there in the protocol/API. Your client may then chose to display those unfurled links however it wants. Slack's client presents them more or less exactly the way users may want, consistently across multiple platforms. Neither IRC no XMPP have that. That's why you mistakenly think that the only recourse is to "accept and run javascript from unkown users on the client". And yes. Most users do want a chat with formatting, unfurled links, inline messages, inline video, emoji reactions, multifunctional bots etc. That's why they flock to Slack, not to IRC/XMPP. --- [1] https://api.slack.com/docs/message-link-unfurling#slack_app_unfurling https://api.slack.com/docs/message-link-unfurling#slack_app_...
- Panino 9y agoI tried the commands given (plus a few more I just guessed) and they all worked. What an enlightening demonstration of IRC's simplicity! This comes at a good time because I've been having issues with eggdrop, maybe now I'll just write something tiny to replace the bits of functionality I want.
- hex1848 9y agoTIL that eggdrop is still being developed / maintained.. I had a few bots running around EFNet and Undernet in ~96. Hadn't heard this reference in years. http://www.eggheads.org/ http://www.eggheads.org/
- efdee 9y agoOp me cause I'm lame.
- J-Kuhn 9y agoThe problem with eggdrop is that it does TOO much things. * Keeping an internal ban list? Check. * Removing stale bans from the channel? Check. * Keep the bot opped? Check. * Has built-in user management? Check. * Uses telnet or DCC to manage the bot? Check. All that features have it's use, but most of the time they are not needed. Instead people new to eggdrop have to "fight" with that features. * User keeps getting banned when he enters the channel, even after an op removed the ban. Channel op has to learn about the internal ban list. * Eggdrop removes all bans after 180 minutes (default). Eggdrop admin has to disable that feature or add the user to the internal ban list. * For non-channel admin bots, the bot does not need to be op. Eggdrop will complain about it. * Built-in user management uses part of the hostmask. You got a new ISP, good luck restoring your access to the bot. And it doesn't play nice with the accounts from IRC services. * DCC doesn't work behind if you are behind NAT. And using telnet means using a different program. In the past, I tried to solve several of that problems with Tcl scripts, with variable success. * Allow the bot to be managed through commands in IRC. * Bind to raw events, hide them (return 1) from eggdrop and send a replacement command through an internal API. I had to use that to make eggdrop aware of the popular +qa modes (channel owner and channel admin) Or replace the user host so eggdrop sees a fake host with the account name in it. Solves the problem with the user management through hostmasks. In the end, I gave up. I wrote an IRC Bot in Tcl and re-implemented the Tcl API, so I could use the old eggdrop scripts.
- janvdberg 9y agoFWIW, you can still use your favorite IRC client (e.g. WeeChat + Glowing Bear) with Slack by using wee-slack (https://github.com/wee-slack/wee-slack https://github.com/wee-slack/wee-slack)
- apetresc 9y agoI've been using wee-slack for months, but I always assumed it was using the IRC bridge under the hood - judging by the fact that it's still working right now, I guess that's not the case :)
- u801e 9y agoI think they'll shut down all remaining IRC and XMPP gateways by May 15. So we still have a little over 2 months from now.
- moosingin3space 9y agoIt uses the WebSocket API.
- pimeys 9y agoWhen I learn a new language, the first things I do is I write an IRC bot. Such a fun task. Right now my plan is to convert my good old (but still in heavy use, with MegaHAL!) bot [0] to Haskell, while reading the book and learning the language. The current bot was my last ever Ruby project and while I take using a new language as a challenge, the Cinch [1] framework is definitely worth a try if you want to create a bot quickly. [0] https://github.com/pimeys/diskotappi https://github.com/pimeys/diskotappi [1] https://github.com/cinchrb/cinch https://github.com/cinchrb/cinch
- larrik 9y ago> IRC is over 20 years old IRC is turning 30 this year, actually. Yeah
- Posibyte 9y agoSircmpwn is a user on this site. There are so many times I've opened a link to a piece of software, an article, or a tutorial and thought "Wow, this is cool" or "Hey, this is fun to read." And Sircmpwn has repeatedly been an author I've seen that sort of content from and felt like I got something nice out of it every time. Sircompwn, if you're reading this, thanks for the neat content. I don't mind stumbling upon them during my lunch breaks :)
- iforgotpassword 9y agoYeah, a bit like ludde in the old days. I've used or enjoyed scumm VM, openttd and utorrent a lot. I also remembered truecraft right now when I saw this post and went to check on it. The git repo is now archived and read only, but didn't find a mention anywhere if/why development was given up.
- Sir_Cmpwn 9y agoTrueCraft needs a lot of work that I don't have time for right now, it gets in the way of my other FOSS work. I'll work on it more if I make enough recurring donation revenue to work on FOSS full time. Progress: https://drewdevault.com/donate https://drewdevault.com/donate
- iforgotpassword 9y agoThat makes sense, thanks for the clarification. That archived message on github just felt like it's a permanent decision. And since I started using sway recently I'm pretty OK with your priorities. ;)
- Sir_Cmpwn 9y agoThanks :)
- 8_hours_ago 9y agoFor those wondering, RFC's can be installed to /usr/share/doc/rfc/txt/ with the rfc package[0] on Arch Linux. Ubuntu has the doc-rfc package[1] with installs to /usr/share/doc/RFC. [0]: https://www.archlinux.org/packages/community/any/rfc/ https://www.archlinux.org/packages/community/any/rfc/ [1]: https://packages.ubuntu.com/xenial/doc-rfc https://packages.ubuntu.com/xenial/doc-rfc
- earenndil 9y agoNot directly related, but I found an irc bot this guy wrote. IN BRAINFUCK. https://github.com/SirCmpwn/bf-irc-bot https://github.com/SirCmpwn/bf-irc-bot
- purplezooey 9y agoNuts. We were writing IRC bots in the 1990s when eggdrop bot was around.
- vldr 9y agoanyone remember VladBot?
- sudshekhar 9y agoAre there any good books/comprehensive resources for a beginner wanting to experiment with the irc protocol? I tried setting up my own irc server on an aws instance once. Opening the firewalls, connecting it to other clouds and to the clients was hard [for me]. Would love a step by step guide, that gives quick win and further confidence to get started. This was my original inspiration: https://aaronparecki.com/2015/08/29/8/why-i-live-in-irc https://aaronparecki.com/2015/08/29/8/why-i-live-in-irc
- Lord_Zero 9y agoShameless plug for our NodeJS IRC Bot Framework Tennu: https://github.com/Tennu/tennu https://github.com/Tennu/tennu Connect in one line of code: `require('tennu').Client('../config/myNetwork.json').connect();`