73°F

Aaron Parecki

  • Articles
  • Notes
  • Photos
  • Loqi the Friendly IRC Bot

    February 12, 2011

    Loqi is an IRC bot that lurks in several channels on irc.freenode.net. He is mostly a utility bot, but occasionally enjoys a bit of playful conversation.

    About

    Loqi is built around the MediaWiki Recent Changes bot. This is a small Perl script that uses POE::Component::IRC to speak the IRC protocol.

    What Loqi Does

    Loqi started out as a way to alert us of recent changes in MediaWiki instances. When a UDP packet is received from a MediaWiki instance, a message is printed in the corresponding channel. This mechanism has allowed Loqi to be extended to many other purposes. I can easily send messages to Loqi from other scripts and other servers by simply sending a UDP packet. This has allowed me to use Loqi for debugging and logging of websites, as an easy way to get notifications of unusual activity in the system without checking log files.

    How Loqi Works

    • The MediaWiki Perl script is the core of Loqi. This is the IRC client and UDP server which listens for incoming packets and routes them to IRC.
    • When a message is received in the IRC channel, the Perl script launches a PHP script using open() and pipes the IRC line to stdin of the PHP script.
    • PHP takes over reading the input from stdin. The first thing the script does is spawn a new process, thereby freeing up the Perl script that launched it. This allows the PHP script to take an indefinite amount of time to handle the message without hanging the main bot.
    • With this mechanism in place, Loqi can be programmed to respond to various trigger words by writing new handlers in PHP. The response can come in a long time later, whether it's seconds or minutes, which helps make Loqi feel less like a bot and more like a real person.

    What Loqi is Not

    Loqi is not a chatbot like ALICE or Eliza. He will respond to various trigger words, but don't expect to have a full conversation with him. As a consequence, his responses seem less scripted, and you may not even notice he is a bot at first, such as in this exchange from #pdxwebdev:

    donpdonp: i might have to just pony up the dough
    tyler: I WANT A PONY
    * Loqi gives tyler-iphone A PONY
    tyler: yay!
    * Loqi giggles
    tyler: i never know if its the loqi AI or aaron
    * Loqi grins profusely
    caseorganic: haha - it's all loqi ai
    Loqi: awesome
    

    Commands

    • !calc 12 ounces to cups - Loqi can do most any unit conversions and calculations that you can type.
    • !date 1301943765 - Loqi can convert between unix timestamps and readable dates. Try giving him other date formats too.
    • !dns 173.230.151.31 - Loqi can do forward and reverse DNS lookups
    • !weather or !weather 97214 - Loqi can get a 2-day weather forecast for a given zipcode
    • !temperature or !temperature 97214 - Loqi can get the current temperature for a given zipcode
    • !digits 503-346-RIDE - Convert text to the numeric equivalent on a phone keypad

    Channels

    You can find Loqi in these channels on irc.freenode.net.

    • #geoloqi
    • #indiewebcamp
    • #microformats
    • #pdxwebdev

    Some fun conversations Loqi has been a part of are documented on his Tumblr account: loqisaur.tumblr.com

    Sat, Feb 12, 2011 2:00pm -08:00
    2 likes 2 mentions
    • Thierry Marianne
    • Kyle Mahan

    Other Mentions

    • sair twitter.com/sairsyr
      I wrote one of these years ago. It’s great for lazy people like me. You type “weather 13104” and it will spit back at you the weather for Manlius. aaronparecki.com/2011/02/12/4/l…
      Sat, Mar 9, 2019 12:41pm +00:00 (via brid-gy.appspot.com)
    • Aaron Parecki aaronparecki.com
      Loqi the Friendly IRC Bot
      Sat, Feb 12, 2011 2:00pm -08:00
Posted in /articles

Hi, I'm Aaron Parecki, Director of Identity Standards at Okta, and co-founder of IndieWebCamp. I maintain oauth.net, write and consult about OAuth, and participate in the OAuth Working Group at the IETF. I also help people learn about video production and livestreaming. (detailed bio)

I've been tracking my location since 2008 and I wrote 100 songs in 100 days. I've spoken at conferences around the world about owning your data, OAuth, quantified self, and explained why R is a vowel. Read more.

  • Director of Identity Standards at Okta
  • IndieWebCamp Founder
  • OAuth WG Editor
  • OpenID Board Member

  • 🎥 YouTube Tutorials and Reviews
  • 🏠 We're building a triplex!
  • ⭐️ Life Stack
  • ⚙️ Home Automation
  • All
  • Articles
  • Bookmarks
  • Notes
  • Photos
  • Replies
  • Reviews
  • Trips
  • Videos
  • Contact
© 1999-2025 by Aaron Parecki. Powered by p3k. This site supports Webmention.
Except where otherwise noted, text content on this site is licensed under a Creative Commons Attribution 3.0 License.
IndieWebCamp Microformats Webmention W3C HTML5 Creative Commons
WeChat ID
aaronpk_tv