Slack Botkit - 如何从'reaction_added'事件中获取消息的内容

Bra*_*jii 7 javascript node.js slack-api

我正在使用botkit框架在响应添加到消息时进行响应,但我不确定如何在触发事件时提取消息的内容.以下是我目前的情况:

controller.on('reaction_added',function(bot, event) {

   if (event.reaction == 'x') {
      // bot reply with the message's text
   }
});
Run Code Online (Sandbox Code Playgroud)

根据Slack API,我只能获取像event.item这样的数据,它具有消息的类型,通道和ts.有谁知道如何做到这一点?

Bra*_*jii 7

弄清楚了.给定时间戳和频道,我能够在频道历史记录中手动搜索消息并提取我需要的数据.

function getTaskID(channel_id, timestamp, callback) {
  slack.api("channels.history", {
      channel: channel_id,
      latest: timestamp,
      count: 1,
      inclusive: 1
    }, function(err, response) {
      // do something with the response
  });
}
Run Code Online (Sandbox Code Playgroud)