2008-07-16

Python irclib’s privmsg isn’t actually privmsg

I guess irclib is kinda green, but anyway. I was writing a bot and was very confused with its AddPrivMsgRoute and AddPubMsgRoute methods. I’m noob to IRC, so I had to browse the RFC to be sure: in IRC, “privmsg” is the command to send messages to users and channels. And in IRC, there’s no “pubmsg”. In irclib, a “privmsg” is a message destined to you (the bot user), and a “pubmsg” is a message destined to the channel in which you’re on. So, irc.privmsg = { irclib.privmsg, irclib.pubmsg }. The distinction irclib wants to make is useful, but the choice of terminology confused the hell out of me :D

While I’m at it: to respect the RFC, make sure your bots send messages with client.connection.notice and not client.connection.privmsg like many do. /notice is the same as /privmsg (aka /msg in most clients), only automated citizens ignore it. That prevents infinite loops, like the one I often trap myself with when talking to bitlbee’s root user:

   <leoboiko> root: yes
   <root> Did I ask you something?
   <leoboiko> root: yes
   <root> Did I ask you something?
   <leoboiko> root: yes
   <root> Did I ask you something?
   <leoboiko> root: yes
   <root> Did I ask you something?
   <leoboiko> root: yes
   <root> Did I ask you something?
   […]

No comments

No comments yet.

Leave a comment