mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 06:42:51 +02:00
oneOf
This commit is contained in:
@@ -25,10 +25,7 @@ module.exports = class MathQuizCommand extends Command {
|
||||
key: 'difficulty',
|
||||
prompt: `What should the difficulty of the game be? Either ${list(difficulties, 'or')}.`,
|
||||
type: 'string',
|
||||
validate: difficulty => {
|
||||
if (difficulties.includes(difficulty.toLowerCase())) return true;
|
||||
return `Invalid difficulty, please enter either ${list(difficulties, 'or')}.`;
|
||||
},
|
||||
oneOf: difficulties,
|
||||
parse: difficulty => difficulty.toLowerCase()
|
||||
}
|
||||
]
|
||||
|
||||
@@ -24,10 +24,7 @@ module.exports = class QuizCommand extends Command {
|
||||
prompt: `Which type of question would you like to have? Either ${list(types, 'or')}.`,
|
||||
type: 'string',
|
||||
default: 'multiple',
|
||||
validate: type => {
|
||||
if (types.includes(type.toLowerCase())) return true;
|
||||
return `Invalid type, please enter either ${list(types, 'or')}.`;
|
||||
},
|
||||
oneOf: types,
|
||||
parse: type => type.toLowerCase()
|
||||
},
|
||||
{
|
||||
@@ -35,10 +32,7 @@ module.exports = class QuizCommand extends Command {
|
||||
prompt: `What should the difficulty of the game be? Either ${list(difficulties, 'or')}.`,
|
||||
type: 'string',
|
||||
default: '',
|
||||
validate: difficulty => {
|
||||
if (difficulties.includes(difficulty.toLowerCase())) return true;
|
||||
return `Invalid difficulty, please enter either ${list(difficulties, 'or')}.`;
|
||||
},
|
||||
oneOf: difficulties,
|
||||
parse: difficulty => difficulty.toLowerCase()
|
||||
}
|
||||
]
|
||||
|
||||
@@ -25,10 +25,7 @@ module.exports = class TypingTestCommand extends Command {
|
||||
key: 'difficulty',
|
||||
prompt: `What should the difficulty of the game be? Either ${list(difficulties, 'or')}.`,
|
||||
type: 'string',
|
||||
validate: difficulty => {
|
||||
if (difficulties.includes(difficulty.toLowerCase())) return true;
|
||||
return `Invalid difficulty, please enter either ${list(difficulties, 'or')}.`;
|
||||
},
|
||||
oneOf: difficulties,
|
||||
parse: difficulty => difficulty.toLowerCase()
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user