message: First stab at adding support for Slack threaded replies
diff: @@ -427,6 +427,11 @@ module.exports = function(botkit, config) {
  msg.channel = src.channel;
  + // if source message is in a thread, reply should also be in the thread
  + if (src.thread_ts) {
  + msg.thread_ts = src.thread_ts;
  + }
  +
  msg.response_type = 'in_channel';
  bot.res.json(msg);
  cb && cb();
  @@ -447,6 +452,11 @@ module.exports = function(botkit, config) {
  msg.channel = src.channel;
  + // if source message is in a thread, reply should also be in the thread
  + if (src.thread_ts) {
  + msg.thread_ts = src.thread_ts;
  + }
  +
  msg.response_type = 'in_channel';
  var requestOptions = {
  uri: src.response_url,
  @@ -481,6 +491,11 @@ module.exports = function(botkit, config) {
  msg.channel = src.channel;
  + // if source message is in a thread, reply should also be in the thread
  + if (src.thread_ts) {
  + msg.thread_ts = src.thread_ts;
  + }
  +
  msg.response_type = 'ephemeral';
  bot.res.json(msg);
  @@ -502,6 +517,11 @@ module.exports = function(botkit, config) {
  msg.channel = src.channel;
  + // if source message is in a thread, reply should also be in the thread
  + if (src.thread_ts) {
  + msg.thread_ts = src.thread_ts;
  + }
  +
  msg.response_type = 'ephemeral';
  var requestOptions = {
  @@ -537,6 +557,11 @@ module.exports = function(botkit, config) {
  msg.channel = src.channel;
  + // if source message is in a thread, reply should also be in the thread
  + if (src.thread_ts) {
  + msg.thread_ts = src.thread_ts;
  + }
  +
  var requestOptions = {
  uri: src.response_url,
  method: 'POST',
  @@ -567,6 +592,28 @@ module.exports = function(botkit, config) {
  msg.channel = src.channel;
  + // if source message is in a thread, reply should also be in the thread
  + if (src.thread_ts) {
  + msg.thread_ts = src.thread_ts;
  + }
  +
  + bot.say(msg, cb);
  + };
  +
  + bot.replyWithThread = function(src, resp, cb) {
  + var msg = {};
  +
  + if (typeof(resp) == 'string') {
  + msg.text = resp;
  + } else {
  + msg = resp;
  + }
  +
  + msg.channel = src.channel;
  +
  + // to create a thread, set the original message as the parent
  + msg.thread_ts = src.ts;
  +
  bot.say(msg, cb);
  };
  