message: add startPrivateConversationWithActor
diff: @@ -325,14 +325,27 @@ function Sparkbot(configuration) {
  var message_options = {};
  - // if a user is specified, use that -- this happens when a user says something
  - // otherwise, use the actorId - this might happen when a user takes an action
  - // for example, if a user adds a bot to the channel...
  - if (message.user) {
  message_options.toPersonEmail = message.user;
  - } else if (message.original_message.actorId) {
  +
  + botkit.startTask(bot, message_options, function(task, convo) {
  + convo.on('sent', function(sent_message) {
  + // update this convo so that future messages will match
  + // since the source message did not have this info in it.
  + convo.source_message.user = message.user;
  + convo.source_message.channel = sent_message.roomId;
  + });
  + cb(null, convo);
  + });
  + };
  +
  + /**
  + * Convenience method for creating a DM convo.
  + */
  + bot.startPrivateConversationWithActor = function(message, cb) {
  +
  + var message_options = {};
  +
  message_options.toPersonId = message.original_message.actorId;
  - }
  botkit.startTask(bot, message_options, function(task, convo) {
  convo.on('sent', function(sent_message) {
  @@ -345,6 +358,8 @@ function Sparkbot(configuration) {
  });
  };
  +
  +
  bot.send = function(message, cb) {
  // clone the incoming message
  @@ -357,7 +372,7 @@ function Sparkbot(configuration) {
  ciscospark_message.roomId = message.channel;
  delete ciscospark_message.channel;
  - // default the markdown field to be the same as text.
  + // default the markdown field to be the same as tex.
  if (ciscospark_message.text && !ciscospark_message.markdown) {
  ciscospark_message.markdown = ciscospark_message.text;
  }
  