mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 22:32:50 +02:00
emoji-regex
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
const Command = require('../../framework/Command');
|
const Command = require('../../framework/Command');
|
||||||
const { Connect4AI } = require('connect4-ai');
|
const { Connect4AI } = require('connect4-ai');
|
||||||
const { stripIndents } = require('common-tags');
|
const { stripIndents } = require('common-tags');
|
||||||
const emojiRegex = require('emoji-regex/RGI_Emoji.js');
|
const emojiRegex = require('emoji-regex');
|
||||||
const { verify, list } = require('../../util/Util');
|
const { verify, list } = require('../../util/Util');
|
||||||
const { LOADING_EMOJI_ID } = process.env;
|
const { LOADING_EMOJI_ID } = process.env;
|
||||||
const blankEmoji = '⚪';
|
const blankEmoji = '⚪';
|
||||||
@@ -36,7 +36,7 @@ module.exports = class ConnectFourCommand extends Command {
|
|||||||
prompt: `What color do you want to be? Either an emoji or one of ${list(Object.keys(colors), 'or')}.`,
|
prompt: `What color do you want to be? Either an emoji or one of ${list(Object.keys(colors), 'or')}.`,
|
||||||
type: 'default-emoji|custom-emoji|string',
|
type: 'default-emoji|custom-emoji|string',
|
||||||
validate: (color, msg) => {
|
validate: (color, msg) => {
|
||||||
const hasEmoji = new RegExp(`^(?:${emojiRegex().source})$`).test(color);
|
const hasEmoji = new RegExp(`^(?:${emojiRegex().toString()})$`).test(color);
|
||||||
const hasCustom = color.match(customEmojiRegex);
|
const hasCustom = color.match(customEmojiRegex);
|
||||||
if (hasCustom && !msg.guild) return 'You can only use custom emoji in a server.';
|
if (hasCustom && !msg.guild) return 'You can only use custom emoji in a server.';
|
||||||
if (hasCustom && msg.guild && !msg.guild.emojis.cache.has(hasCustom[2])) {
|
if (hasCustom && msg.guild && !msg.guild.emojis.cache.has(hasCustom[2])) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
const ArgumentType = require('../ArgumentType');
|
const ArgumentType = require('../ArgumentType');
|
||||||
const emojiRegex = require('emoji-regex/RGI_Emoji.js');
|
const emojiRegex = require('emoji-regex');
|
||||||
|
|
||||||
module.exports = class DefaultEmojiArgumentType extends ArgumentType {
|
module.exports = class DefaultEmojiArgumentType extends ArgumentType {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
super(client, 'default-emoji');
|
super(client, 'default-emoji');
|
||||||
this.regex = new RegExp(`^(?:${emojiRegex().source})$`);
|
this.regex = new RegExp(`^(?:${emojiRegex().toString()})$`);
|
||||||
}
|
}
|
||||||
|
|
||||||
validate(value) {
|
validate(value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user