import Behavior from '../behavior.js';

class RollTheDice extends Behavior {
  constructor(settings) {
    settings.name = 'Clap Hype';
    settings.description = `'cause 👏 sometimes 👏 you 👏 need 👏 emphasis!`;
    super(settings);

    this.commands.push({
      tag: 'clap',
      description: `I'll hype your message for you 👏👏👏`
    });
  }

  execute(command, message, channel, data) {
    const parsedMessage = this.parseMessage(message);

    this.bot.postMessage(channel, `${parsedMessage.join(' :clap: ')} :clap:`, {
      icon_emoji: ':clap:',
      thread_ts: data.thread_ts
    });
  }

  parseMessage(message) {
    return message.replace(/^!clap/gi, '').replace(/\s+/g, " ").trim().split(' ')
  }
}

export default RollTheDice;

@@ -625,14 +625,26 @@
     
-return
+let splitMessage =
  mes
@@ -692,11 +692,11 @@
 /g, 
-%22 %22
+' '
 ).tr
@@ -710,16 +710,135 @@
 lit(' ')
+;%0A%0A    if (splitMessage.length === 1) %7B%0A      splitMessage = splitMessage%5B0%5D.split('');%0A    %7D%0A%0A    return splitMessage;
 %0A  %7D%0A%7D%0A%0A

#49 !clap <single word> should insert a clapping emoji between each letter