mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 08:08:34 +02:00
choice argument type
This commit is contained in:
@@ -22,12 +22,8 @@ module.exports = class HatCommand extends Command {
|
||||
{
|
||||
key: 'type',
|
||||
prompt: `What type of hat would you like to use? Either ${list(hats, 'or')}.`,
|
||||
type: 'string',
|
||||
validate: type => {
|
||||
if (hats.includes(type.toLowerCase())) return true;
|
||||
return `Invalid type, please enter either ${list(hats, 'or')}.`;
|
||||
},
|
||||
parse: type => type.toLowerCase()
|
||||
type: 'choice',
|
||||
choices: hats
|
||||
},
|
||||
{
|
||||
key: 'user',
|
||||
|
||||
@@ -17,12 +17,8 @@ module.exports = class HoroscopeCommand extends Command {
|
||||
{
|
||||
key: 'sign',
|
||||
prompt: `Which sign would you like to get the horoscope for? Either ${list(signs, 'or')}.`,
|
||||
type: 'string',
|
||||
validate: sign => {
|
||||
if (signs.includes(sign.toLowerCase())) return true;
|
||||
return `Invalid sign, please enter either ${list(signs, 'or')}.`;
|
||||
},
|
||||
parse: sign => sign.toLowerCase()
|
||||
type: 'choice',
|
||||
choices: signs
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -24,12 +24,8 @@ 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')}.`;
|
||||
},
|
||||
parse: difficulty => difficulty.toLowerCase()
|
||||
type: 'choice',
|
||||
choices: difficulties
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
+4
-12
@@ -22,24 +22,16 @@ module.exports = class QuizCommand extends Command {
|
||||
{
|
||||
key: 'type',
|
||||
prompt: `Which type of question would you like to have? Either ${list(types, 'or')}.`,
|
||||
type: 'string',
|
||||
type: 'choice',
|
||||
default: 'multiple',
|
||||
validate: type => {
|
||||
if (types.includes(type.toLowerCase())) return true;
|
||||
return `Invalid type, please enter either ${list(types, 'or')}.`;
|
||||
},
|
||||
parse: type => type.toLowerCase()
|
||||
choices: types
|
||||
},
|
||||
{
|
||||
key: 'difficulty',
|
||||
prompt: `What should the difficulty of the game be? Either ${list(difficulties, 'or')}.`,
|
||||
type: 'string',
|
||||
type: 'choice',
|
||||
default: '',
|
||||
validate: difficulty => {
|
||||
if (difficulties.includes(difficulty.toLowerCase())) return true;
|
||||
return `Invalid difficulty, please enter either ${list(difficulties, 'or')}.`;
|
||||
},
|
||||
parse: difficulty => difficulty.toLowerCase()
|
||||
choices: difficulties
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -13,8 +13,8 @@ module.exports = class RockPaperScissorsCommand extends Command {
|
||||
{
|
||||
key: 'choice',
|
||||
prompt: 'Rock, Paper, or Scissors?',
|
||||
type: 'string',
|
||||
parse: choice => choice.toLowerCase()
|
||||
type: 'choice',
|
||||
choices
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -24,12 +24,8 @@ 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')}.`;
|
||||
},
|
||||
parse: difficulty => difficulty.toLowerCase()
|
||||
type: 'choice',
|
||||
choices: difficulties
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ module.exports = class ChannelInfoCommand extends Command {
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x00AE86)
|
||||
.addField('❯ Name',
|
||||
channel.name || 'None', true)
|
||||
channel.type !== 'dm' ? channel.name : `@${channel.recipient.username}`, true)
|
||||
.addField('❯ ID',
|
||||
channel.id, true)
|
||||
.addField('❯ NSFW',
|
||||
|
||||
@@ -15,13 +15,9 @@ module.exports = class EmojiListCommand extends Command {
|
||||
{
|
||||
key: 'type',
|
||||
prompt: `What type of emoji would you like to view? Either ${list(types, 'or')}.`,
|
||||
type: 'string',
|
||||
type: 'choice',
|
||||
default: 'regular',
|
||||
validate: type => {
|
||||
if (types.includes(type.toLowerCase())) return true;
|
||||
return `Invalid type, please enter either ${list(types, 'or')}.`;
|
||||
},
|
||||
parse: type => type.toLowerCase()
|
||||
choices: types
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -16,22 +16,14 @@ module.exports = class CurrencyCommand extends Command {
|
||||
{
|
||||
key: 'base',
|
||||
prompt: `What currency code do you want to use as the base? Either ${list(codes, 'or')}.`,
|
||||
type: 'string',
|
||||
validate: base => {
|
||||
if (codes.includes(base.toUpperCase())) return true;
|
||||
return `Invalid base, please enter either ${list(codes, 'or')}.`;
|
||||
},
|
||||
parse: base => base.toUpperCase()
|
||||
type: 'choice',
|
||||
choices: codes
|
||||
},
|
||||
{
|
||||
key: 'target',
|
||||
prompt: `What currency code do you want to convert to? Either ${list(codes, 'or')}.`,
|
||||
type: 'string',
|
||||
validate: target => {
|
||||
if (codes.includes(target.toUpperCase())) return true;
|
||||
return `Invalid target, please enter either ${list(codes, 'or')}.`;
|
||||
},
|
||||
parse: target => target.toUpperCase()
|
||||
type: 'choice',
|
||||
choices: codes
|
||||
},
|
||||
{
|
||||
key: 'amount',
|
||||
|
||||
@@ -15,13 +15,9 @@ module.exports = class NameCommand extends Command {
|
||||
{
|
||||
key: 'gender',
|
||||
prompt: `Which gender do you want to generate a name for? Either ${list(genders, 'or')}.`,
|
||||
type: 'string',
|
||||
type: 'choice',
|
||||
default: 'both',
|
||||
validate: gender => {
|
||||
if (genders.includes(gender.toLowerCase())) return true;
|
||||
return `Invalid gender, please enter either ${list(genders, 'or')}.`;
|
||||
},
|
||||
parse: gender => gender.toLowerCase()
|
||||
choices: genders
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -16,12 +16,8 @@ module.exports = class DeviantartCommand extends Command {
|
||||
{
|
||||
key: 'section',
|
||||
prompt: `What section would you like to search? Either ${list(sections, 'or')}.`,
|
||||
type: 'string',
|
||||
validate: section => {
|
||||
if (sections.includes(section.toLowerCase())) return true;
|
||||
return `Invalid section, please enter either ${list(sections, 'or')}.`;
|
||||
},
|
||||
parse: section => section.toLowerCase()
|
||||
type: 'choice',
|
||||
choices: sections
|
||||
},
|
||||
{
|
||||
key: 'query',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { shorten, list } = require('../../util/Util');
|
||||
const { shorten } = require('../../util/Util');
|
||||
const types = ['random', 'top'];
|
||||
|
||||
module.exports = class UrbanDictionaryCommand extends Command {
|
||||
@@ -23,13 +23,9 @@ module.exports = class UrbanDictionaryCommand extends Command {
|
||||
{
|
||||
key: 'type',
|
||||
prompt: 'Do you want to get the top answer or a random one?',
|
||||
type: 'string',
|
||||
type: 'choice',
|
||||
default: 'top',
|
||||
validate: type => {
|
||||
if (types.includes(type.toLowerCase())) return true;
|
||||
return `Invalid type, please enter either ${list(types, 'or')}.`;
|
||||
},
|
||||
parse: type => type.toLowerCase()
|
||||
choices: types
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -15,12 +15,8 @@ module.exports = class Base64Command extends Command {
|
||||
{
|
||||
key: 'mode',
|
||||
prompt: `Would you like to ${list(modes, 'or')}?`,
|
||||
type: 'string',
|
||||
validate: mode => {
|
||||
if (modes.includes(mode.toLowerCase())) return true;
|
||||
return `Invalid mode, please enter either ${list(modes, 'or')}.`;
|
||||
},
|
||||
parse: mode => mode.toLowerCase()
|
||||
type: 'choice',
|
||||
choices: modes
|
||||
},
|
||||
{
|
||||
key: 'text',
|
||||
|
||||
@@ -14,12 +14,8 @@ module.exports = class BinaryCommand extends Command {
|
||||
{
|
||||
key: 'mode',
|
||||
prompt: `Would you like to ${list(modes, 'or')}?`,
|
||||
type: 'string',
|
||||
validate: mode => {
|
||||
if (modes.includes(mode.toLowerCase())) return true;
|
||||
return `Invalid mode, please enter either ${list(modes, 'or')}.`;
|
||||
},
|
||||
parse: mode => mode.toLowerCase()
|
||||
type: 'choice',
|
||||
choices: modes
|
||||
},
|
||||
{
|
||||
key: 'text',
|
||||
|
||||
Reference in New Issue
Block a user