Add . if length is 1

This commit is contained in:
Dragon Fire
2024-03-24 21:22:28 -04:00
parent 453b432128
commit f5df89899e
+1
View File
@@ -53,6 +53,7 @@ module.exports = class YodaCommand extends Command {
const split = sentence.split(' ');
return split.map((word, i) => i === 0 || word === 'i' ? firstUpperCase(word) : word).join(' ');
});
if (newSentences.length === 1) newSentences.push('.');
return `${newSentences.join('. ').trim()} ${ends[Math.floor(Math.random() * ends.length)]}`;
}
};