Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
集成到倍洽(bearychat)的hook代码
{TextMessage} = require '../node_modules/hubot/src/message'
module.exports = (robot) ->
robot.router.post '/hubot/bearychat/:room', (req, res) ->
data = if req.body.payload? then JSON.parse req.body.payload else req.body
robot._send ?= robot.adapter.send;
robot.adapter.send = (user,strings...) ->
res.send {text: strings.toString()} if user.user.name is "http"
robot.adapter.send = robot._send if user.user.name isnt "http"
user = robot.brain.userForId '1', name: 'http', room: 'http'
robot.receive new TextMessage user, data.text, 'messageId'
@williamherry

This comment has been minimized.

@yuanbohan

This comment has been minimized.

Copy link

yuanbohan commented Sep 8, 2015

你好,不过 BearyChat 的中文名是倍洽,而不是 简聊。 简聊的地址是 这里

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.