To extend my introduction to FICS bot writing I decided to share some code.
The mekk.fics library allows one to write asynchronous FICS bots and utilities in Python. I created it mostly by factoring reusable code out of WatchBot sources, polishing it here and there, extending test suite, and documenting.
Is this event-based approach necessary to interface FICS? Of course not, but I believe that it fits the context fairly well, and … that writing some asynchronous code is a good experience for every programmer.
The library is in no way finished and may never be: it covers only some of FICS commands and notifications, and my plan is rather to extend it on per need basis, than to systematically cover everything FICS does. If you need some currently missing command or event, let me know.
The implemented code should be rather stable – as I said, noticeable parts of it were taken from Watchbot, so experienced a couple of years of continuous work.
Using the library
The code is hosted on bitbucket, clone it from there.
Bugs and improvement suggestions should also be reported using bitbucket issue tracker.
I have not yet released the library to PyPi (so no
easy_install mekk.fics for
now), if this would make your life easier, please let me know.
And more bot-like sample: observing some FICS events, making simple stats out of them, and responding to people's commands.