mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
@@ -20,7 +20,7 @@ module.exports = class StringArgumentType extends ArgumentType {
|
|||||||
example(msg, arg) {
|
example(msg, arg) {
|
||||||
if (arg.oneOf) return arg.oneOf[Math.floor(Math.random() * arg.oneOf.length)];
|
if (arg.oneOf) return arg.oneOf[Math.floor(Math.random() * arg.oneOf.length)];
|
||||||
let sentence = '';
|
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));
|
const valid = words.filter(word => sentence.length + word.length + 1 <= (arg.max || 100));
|
||||||
if (!valid.length) break;
|
if (!valid.length) break;
|
||||||
sentence += ` ${valid[Math.floor(Math.random() * valid.length)]}`;
|
sentence += ` ${valid[Math.floor(Math.random() * valid.length)]}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user