If anybody says a three word phrase, the bot turns it into a Yoda quote. For example, I need food becomes 'food, I need'
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let wordlist = context.params.event.content.toLowerCase().replace(/,/g, " ").split(" ").filter(x => x);
let word1 = wordlist[0];
if (word1 === 'i') {
word1 = 'I'
};
if (word1 == 'im' || word1 == `i'm`) {
word1 = `I'm`
};
let word2 = wordlist[1];
if (word2 == 'i') {
word2 = 'I'
};
if (word2 == 'im' || word2 == `i'm`) {
word2 = `I'm`
};
let word3 = wordlist[2].charAt(0).toUpperCase() + wordlist[2].slice(1);
if (wordlist.length === 3) {
await lib.discord.channels['@0.1.0'].messages.create({
channel_id: context.params.event.channel_id,
content: `"${word3}, ${word1} ${word2}" \n -Yoda`
});
}