mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
12e8af1e92
This reverts commit de0a8fbe42.
20 lines
468 B
JavaScript
20 lines
468 B
JavaScript
const { ArgumentType } = require('discord.js-commando');
|
|
const { list } = require('../util/Util');
|
|
|
|
class ChoiceArgumentType extends ArgumentType {
|
|
constructor(client) {
|
|
super(client, 'choice');
|
|
}
|
|
|
|
validate(value, msg, arg) {
|
|
if (arg.choices.includes(value.toLowerCase())) return true;
|
|
return `Invalid ${arg.label}, please enter either ${list(arg.choices, 'or')}.`;
|
|
}
|
|
|
|
parse(value) {
|
|
return value.toLowerCase();
|
|
}
|
|
}
|
|
|
|
module.exports = ChoiceArgumentType;
|