【发布时间】:2015-09-29 22:46:15
【问题描述】:
似乎没有timestamp 属性,而id 属性是undefined。这是hubot的插件脚本代码:
module.exports = (robot) ->
robot.hear /\bclocks?\b/i, (msg) ->
msg.http("https://slack.com/api/reactions.add")
.query({
token: process.env.SLACK_API_TOKEN
name: "bomb"
timestamp: msg.message.timestamp # This property doesn't exist
})
.post() (err, res, body) ->
console.log(body)
return
我从 Slack API 得到的响应是:
{"ok":false,"error":"bad_timestamp"}
当我登录 msg.message 时,它看起来像这样:
{ user:
{ id: 'abc123',
name: 'travis',
room: 'test-bots',
reply_to: 'zyx987' },
text: 'clock',
id: undefined,
done: false,
room: 'test-bots' }
如何获取触发侦听器的消息的时间戳或 ID?
【问题讨论】:
标签: coffeescript hubot slack-api