2009/5/12 云帆江 <jyf...@gmail.com>
then,i will do that,which feature do you want?
send me a require list
Hmm, to be honest, I've never thought seriously enough about the IM API or Bot API's details. Here goes my first attempt ;)
The bots run on the OpenResty server and be bound to the OpenResty accounts. "Bot objects" are first-class entities just like Models, Views, or Roles. Hence the following interfaces should work as expected:
GET/POST/PUT/DELETE /=/bot # bot object list operations
GET/POST/PUT/DELETE /=/bot/Foo # bot object operations
The Bot objects should obey the ACL rules and surely should have certain policies to prevent potential abuse by account owners (to protect the OpenResty service provider like Yahoo! China as well).
Bots should have certain properties (just like those for Feed or View objects). The first stuffs coming into my mind are IM protocol, IM server configurations, nick name used by the bots, and the underlying Views or Actions or Models driving the bots. For the last thingies, I mean bots' behaviors should be driven by Views or Actions. The two typical scenarios currently in my head are like these:
1. Interactive bots (just as what the blog post you mentioned says) accept incoming IM messages, using the message contents (sender nick, message body, and etc) as queries to ask Views or Actions for replies (if any).
2. Bots for logging (or loggers) are not expected to say anything but listening and feeding most (if not all) incoming messages to an Action to save or inserting into a Model directly.
Conceptually these two have no inherent differences at all, and could and also should be using the same interface.
These are just my (very) vague ideas and lots of details are omitted. Comments and other cooler ideas (if any) will be highly appreciated.