From 478748b7982b11770863277ecfb541560bfc9e8c Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Fri, 17 May 2024 10:21:29 -0400 Subject: [PATCH] Fix --- framework/types/string.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/types/string.js b/framework/types/string.js index 4842a6ca..5698c813 100644 --- a/framework/types/string.js +++ b/framework/types/string.js @@ -20,8 +20,11 @@ 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 ? Math.min(arg.max, 100) : 100)) { - const valid = words.filter(word => sentence.length + word.length + 1 <= (arg.max || 100)); + while (sentence.length <= (arg.max ? Math.min(arg.max, 50) : 50)) { + const valid = words.filter(word => { + const max = arg.max ? Math.min(arg.max, 50) : 50; + return sentence.length + word.length + 1 <= max; + }); if (!valid.length) break; sentence += ` ${valid[Math.floor(Math.random() * valid.length)]}`; }