Cylbo
Cylbo

Reputation: 11

copying the 2nd part of a command and putting it on the end of the response

how would I put the 2nd part of a command at the end of the bot's response.

example:

me: !example example.html

bot: example.com/example.html

another example:

me: !example example2.html

bot: example.com/example2.html

Upvotes: 1

Views: 16

Answers (1)

sonEtLumiere
sonEtLumiere

Reputation: 4562

I hope this helps

function convert(me){
  var transform = me.replace('!', '').split(' ');
  transform[0] += '.com/';
  var bot = transform.join('');
  return bot
}

console.log(convert('!example example2.html'));

Upvotes: 1

Related Questions