看到「PHP BotMan」這個專案 (A framework agnostic PHP library to build chat bots),把各家 IM 工具都串起來讓你直接接上去用,在 initialize 完後,就可以這樣寫:
$botman->hears('keyword', function(BotMan $bot) { // do something to respond to message $bot->reply('You used a keyword!'); });
或是:
$botman->fallback(function(BotMan $bot) { return $bot->reply('Sorry I do not know this command'); });