This commit is contained in:
Dragon Fire
2024-05-17 10:04:58 -04:00
parent d6ef8afeb8
commit fd98087243
+1 -1
View File
@@ -20,7 +20,7 @@ module.exports = class StringArgumentType extends ArgumentType {
example(msg, arg) {
if (arg.oneOf) return arg.oneOf[Math.floor(Math.random() * arg.oneOf.length)];
let sentence = '';
while (sentence.length <= (arg.min || 50) || sentence.length <= (arg.max || 100)) {
while (sentence.length <= (arg.min || 50) || sentence.length <= (arg.max ? Math.min(arg.max, 100) : 100)) {
const valid = words.filter(word => sentence.length + word.length + 1 <= (arg.max || 100));
if (!valid.length) break;
sentence += ` ${valid[Math.floor(Math.random() * valid.length)]}`;