mirror of
https://github.com/kennethreitz-archive/changebot.git
synced 2026-06-05 23:40:18 +00:00
Say accepts callbacks
This commit is contained in:
committed by
Chris Wanstrath
parent
89c3847d62
commit
aef5793c3b
+3
-3
@@ -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) ->
|
||||
|
||||
Reference in New Issue
Block a user