diff --git a/commands/info/emoji-list.js b/commands/info/emoji-list.js index 24a3d015..624105bc 100644 --- a/commands/info/emoji-list.js +++ b/commands/info/emoji-list.js @@ -8,12 +8,26 @@ module.exports = class EmojiListCommand extends Command { group: 'info', memberName: 'emoji-list', description: 'Responds with a list of the server\'s custom emoji.', - guildOnly: true + guildOnly: true, + args: [ + { + key: 'type', + prompt: 'Would you like to view animated emoji or regular emoji?', + type: 'string', + default: 'regular', + validate: type => { + if (['animated', 'regular'].includes(type.toLowerCase())) return true; + return 'Invalid type, please enter either animated or regular.'; + }, + parse: type => type.toLowerCase() + } + ] }); } - run(msg) { - if (!msg.guild.emojis.size) return msg.say('This server has no custom emoji.'); - return msg.say(msg.guild.emojis.map(emoji => emoji.toString()).join('')); + run(msg, { type }) { + const emojis = msg.guild.emojis.filter(emoji => type === 'animated' ? emoji.animated : !emoji.animated); + if (!emojis.size) return msg.say(`This server has no ${type} custom emoji.`); + return msg.say(emojis.map(emoji => emoji.toString()).join(' '), { split: { char: ' ' } }); } }; diff --git a/commands/info/emoji.js b/commands/info/emoji.js index b368df2f..24ee0164 100644 --- a/commands/info/emoji.js +++ b/commands/info/emoji.js @@ -31,8 +31,8 @@ module.exports = class EmojiInfoCommand extends Command { emoji.id, true) .addField('❯ Creation Date', emoji.createdAt.toDateString(), true) - .addField('❯ External?', - emoji.managed ? 'Yes' : 'No', true); + .addField('❯ Animated?', + emoji.animated ? 'Yes' : 'No', true); return msg.embed(embed); } }; diff --git a/commands/search/npm.js b/commands/search/npm.js index 823a5f25..9c9ae7a3 100644 --- a/commands/search/npm.js +++ b/commands/search/npm.js @@ -27,6 +27,7 @@ module.exports = class NPMCommand extends Command { async run(msg, { pkg }) { try { const { body } = await snekfetch.get(`https://registry.npmjs.com/${pkg}`); + if (!body.time.unpublished) return msg.say('This package no longer exists.'); const version = body.versions[body['dist-tags'].latest]; const maintainers = trimArray(body.maintainers.map(user => user.name)); const dependencies = version.dependencies ? trimArray(Object.keys(version.dependencies)) : null; diff --git a/commands/text-edit/mocking.js b/commands/text-edit/mocking.js index 1c5431a5..aedf9e40 100644 --- a/commands/text-edit/mocking.js +++ b/commands/text-edit/mocking.js @@ -23,7 +23,7 @@ module.exports = class MockingCommand extends Command { run(msg, { text }) { for (let i = 0; i < text.length; i += Math.floor(Math.random() * 4)) text[i] = text[i].toUpperCase(); - return msg.say(`${text.join('')} <:sponge:318612443398144000>`); + return msg.say(`${text.join('')} <:sponge:390141884070363138>`); } }; diff --git a/package.json b/package.json index 5f76b37f..ea6496f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "60.2.0", + "version": "60.2.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { diff --git a/types/emoji.js b/types/emoji.js index 6e0df664..c8ee6852 100644 --- a/types/emoji.js +++ b/types/emoji.js @@ -7,7 +7,7 @@ class EmojiArgumentType extends ArgumentType { } validate(value, msg) { - const matches = value.match(/^(?:<:([a-zA-Z0-9_]+):)?([0-9]+)>?$/); + const matches = value.match(/^(?:?$/); if (matches && msg.client.emojis.has(matches[2])) return true; if (!msg.guild) return false; const search = value.toLowerCase();