Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

LaServ (a play on Lazers, The Bridge's feedbot and '*Serv' bots, which provide IRC services ) is a Python/Twisted project that I've been poking at since the Christmas break. It's still beta quality, but it's ready for more eyes and input. In its current incarnation, it is an IRC bot, but the overall project is far more flexible and extensible than the label "IRC bot" normally indicates.

Let's start with what it does currently:

Current Features

  • IRC protocol client/'bot
  • Can poll and read the question feed from a given Stack Exchange site (currently configured for Gaming.SE)
  • Can read, parse, and output RSS feeds (Currently configured for the Starred Items feed for The Bridge)
  • Can store persistent user information, including API 2.0 access_tokens.
  • Responds to some commands that are access_token related via a private message (inbox to read your unread inbox items, rep to see your current/daily/weekly/etc. reputation, for example)

You can find out more about LaServ's current form and how to use it at its home page, or you can watch it in action on irc.gamesurge.net, channel #laserv.

Library Features

  • Full Twisted-compatible support for Stack Exchange API v2.0, including authenticating users with access_tokens
  • Can "poll" the API for things like question feeds, and "on demand" query the API for things like unread inbox/rep on demand.
  • Support for RSS feeds including conditional GET
  • Flexible plugin architecture for adding new features while the application is still running
  • Loose, pythonic bindings between components, allowing for easy repurposing and refactoring

Essentially, although LaServ is an IRC bot with a few limited functions today, it could just as easily communicate via any protocol with Twisted support, and it could access any API endpoint of your/my choosing. The limits are only the bounds of Python and the API. Plugins are lightweight, and the libraries provided abstract most of the complexity without sacrificing flexibility.

The Twisted-friendly API library and RSS library are also separable/standalone enough that they could be easily incorporated in a different application if you so choose.

Having said that, I don't really know what's next for it, so part of my reason for posting it here is to find out how it could be useful in the future. The libraries could be more robust, it could have more interface options, or it could have expanded command options via plugins, among many things.

If, after evaluating it, you have an idea or a request, or wish to contribute, please let me know. If there's not much interest in it, I'll probably continue using it in its current form and move on to the next idea in my project list. :)

Source

laserv.py is the main entry point for the application. Files under "lscore" are core libraries that are essential to proper operation of the system. Files under "lsplugins" are optional libraries that can be loaded, unloaded, or reloaded at runtime.

Everything in LaServ is released under the BSD 2-clause license for easy inclusion in the project of your choice. I would appreciate acknowledgement/upvotes/manilla envelopes stuffed with unmarked bills if you find parts of the project useful.

Right now, the code is hosted at Bitbucket, since I'm a fan of Mercurial, although I'm not exactly married to this provider.

Running

There's not much documentation on running your own instance, but I'll provide some basics that can be expanded if there's interest.

The prerequisites are:

  • Python (I'm using 2.6, and I'm pretty sure 2.7 should work, if there are minor edits or errors, let me know and I'll try to roll them in)
  • Twisted (Recent enough to have the Agent library, I think this was introduced in 2010)
  • Feedparser (for RSS support)

I'm running on CentOS 5.x, which has Python 2.4 and some very old Twisted libraries. The EPEL repository has Python 2.6 packages, but I had to roll my own python 2.6-twisted and python 2.6-feedparser. The .spec files are included in the source tree in case you're in a similar position, but most "sane" distributions of Linux should be fine, and Windows users can install from the official releases.

LaServ looks for laserv.cfg in the directory where laserv.py is for configuration options. The configuration file format is "ini" style. An example is provided with the basic options set to default values. If there's a configuration option you need that isn't supported, adding it is (usually) trivial, so don't be afraid to ask.

share|improve this question
add comment

You must log in to answer this question.

Browse other questions tagged .