mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix default emoji type
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
const ArgumentType = require('../ArgumentType');
|
||||
const emojiRegex = require('emoji-regex');
|
||||
const emojiRegex = require('emoji-regex')();
|
||||
|
||||
module.exports = class DefaultEmojiArgumentType extends ArgumentType {
|
||||
constructor(client) {
|
||||
super(client, 'default-emoji');
|
||||
this.regex = new RegExp(`^(?:${emojiRegex().toString()})$`);
|
||||
}
|
||||
|
||||
validate(value) {
|
||||
if (!this.regex.test(value)) return false;
|
||||
if (!emojiRegex.test(value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
parse(value) {
|
||||
return value;
|
||||
return value.match(emojiRegex)[0];
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user