Jabber meets Twitter
Nothing new, I don’t like the twitter web interface. Neither to read, nor to write messages. So I developed some scripts to tweet from command line. These tools are still working, but not that comfortable as preferred.
Today I had a great thought. At Gajim I’m online at least 24/7, talking with people, getting news etc. So the comparison with twitter is obvious.
After some research how to connect to twitter and jabber I decided to implement the bot in Perl. I still worked a little bit with Net::Twitter, so one side of the connection is almost done. For the other side I used the module Net::Jabber::Bot to implement a bot listening for messages or commands and sending twitter news via IM to my jabber account. The call for the jabber bot looks like:
Most of it should be clear, the function
messageCheck is called when a new message arrives the bot’s jabber account. There I parse the text whether it starts with
! (then it’s a command) otherwise the bot schould take the message to update the twitter status.
updateCheck is the background function, it’s called when the bot idles. Here is time to check for news at twitter. It is called
The rest is merely a matter of form. News from twitter are jabber’ed, IM’s from the authorized user are twitter’ed. Cool, isn’t it!?
Just download the tool, create a new jabber account for the bot (you’ll get one for example from jabber.ccc.de) and update the
jmt.conf file with your credentials.
Of course you need the additional Perl modules, if you also experience various problems with Net::Jabber::Bot try to use the latest code from git://github.com/toddr/perl-net-jabber-bot.git.
The bot could simply be launched by running the Perl script. Send
!help to the bot to get some information about known commands.
Just start it at any server/PC that has a network connection.
What comes next? If anyone would provide a server I would like to implement a multiuser tool, maybe with database connectivity!?