Posted by Neil Crosby on March 19, 2008 12:19 PM
Recently I’ve been playing around with Twitter Bots. I had a need to be able to let just the people I work with when someone had brought food into the office, so I created yahoofood. I wanted near real-time updates of when The Ten Word Review was updated, so I created the ttwr bot. I also want to allow people to review things on The Ten Word Review using their mobile phones, so I’m going to be needing to create a bot for that.
Then it dawned on me that these functionalities would be things what would possibly be of use to other people. I registered twitbot.com and started to refactor things a bit. The result is the code that’s available to download (don’t worry, it’ll be being updated as and when I write more) and the presentation that I gave on sunday morning.
Since the talk I’ve realised that I don’t really say anywhere how to call the bots. The basic pattern goes a little something like this:
$aBotVars['last_data_time'] = strtotime($aBotVars['last_data_time']); $lastDataTime = $aBotVars['last_data_time']; $bot = new $botClass( array( 'username' => 'someUsername', 'password' => 'somePassword', 'last_data_time' => unixTimestampForLastDataRetrieved ) ); $bot->run(); $newLastDataTime = $bot->getLastDataTime();
And that’s all you need to do. Simple.