bots
Version:
Build robust networks of bots that can react to events
20 lines (16 loc) • 456 B
text/coffeescript
{EventEmitter} = require 'events'
module.exports = class Cli extends EventEmitter
listen: ->
if command = process.argv.slice(2).join(' ')
command
else
process.stdin.resume()
process.stdin.setEncoding 'utf8'
process.stdin.on 'data',
handle: (chunk) =>
message =
body: chunk.toString()
say: (thing, callback) ->
console.log thing
callback?()
'message', message