mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +02:00
choice argument type
This commit is contained in:
@@ -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
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user