Animated emoji, npm fix

This commit is contained in:
Daniel Odendahl Jr
2017-12-31 22:48:48 +00:00
parent d2e9bfbf3e
commit 0933c8f318
6 changed files with 24 additions and 9 deletions
+18 -4
View File
@@ -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: ' ' } });
}
};
+2 -2
View File
@@ -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);
}
};
+1
View File
@@ -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;
+1 -1
View File
@@ -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>`);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "60.2.0",
"version": "60.2.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
+1 -1
View File
@@ -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(/^(?:<a?:([a-zA-Z0-9_]+):)?([0-9]+)>?$/);
if (matches && msg.client.emojis.has(matches[2])) return true;
if (!msg.guild) return false;
const search = value.toLowerCase();