Say accepts callbacks

This commit is contained in:
Kyle Neath
2010-12-18 14:13:45 +08:00
committed by Chris Wanstrath
parent 89c3847d62
commit aef5793c3b
+3 -3
View File
@@ -82,14 +82,14 @@ dispatch = (message) ->
[ pattern, handler ] = pair
if message.user.username isnt username and match = message.message.match(pattern)
message.match = match
message.say = (thing) -> say(message.topic.id, thing)
message.say = (thing, callback) -> say(message.topic.id, thing, callback)
handler(message)
log = (message) ->
console.log "#{message.topic.name} >> #{message.user.username}: #{message.message}"
say = (topic, message) ->
post "/api/topics/#{topic}/messages/create.json", qs.stringify(message: message)
say = (topic, message, callback) ->
post "/api/topics/#{topic}/messages/create.json", qs.stringify(message: message), callback
listen = ->
get '/api/live.json', (body) ->