mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 13:56:25 +02:00
Animated emoji, npm fix
This commit is contained in:
@@ -8,12 +8,26 @@ module.exports = class EmojiListCommand extends Command {
|
|||||||
group: 'info',
|
group: 'info',
|
||||||
memberName: 'emoji-list',
|
memberName: 'emoji-list',
|
||||||
description: 'Responds with a list of the server\'s custom emoji.',
|
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) {
|
run(msg, { type }) {
|
||||||
if (!msg.guild.emojis.size) return msg.say('This server has no custom emoji.');
|
const emojis = msg.guild.emojis.filter(emoji => type === 'animated' ? emoji.animated : !emoji.animated);
|
||||||
return msg.say(msg.guild.emojis.map(emoji => emoji.toString()).join(''));
|
if (!emojis.size) return msg.say(`This server has no ${type} custom emoji.`);
|
||||||
|
return msg.say(emojis.map(emoji => emoji.toString()).join(' '), { split: { char: ' ' } });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ module.exports = class EmojiInfoCommand extends Command {
|
|||||||
emoji.id, true)
|
emoji.id, true)
|
||||||
.addField('❯ Creation Date',
|
.addField('❯ Creation Date',
|
||||||
emoji.createdAt.toDateString(), true)
|
emoji.createdAt.toDateString(), true)
|
||||||
.addField('❯ External?',
|
.addField('❯ Animated?',
|
||||||
emoji.managed ? 'Yes' : 'No', true);
|
emoji.animated ? 'Yes' : 'No', true);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ module.exports = class NPMCommand extends Command {
|
|||||||
async run(msg, { pkg }) {
|
async run(msg, { pkg }) {
|
||||||
try {
|
try {
|
||||||
const { body } = await snekfetch.get(`https://registry.npmjs.com/${pkg}`);
|
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 version = body.versions[body['dist-tags'].latest];
|
||||||
const maintainers = trimArray(body.maintainers.map(user => user.name));
|
const maintainers = trimArray(body.maintainers.map(user => user.name));
|
||||||
const dependencies = version.dependencies ? trimArray(Object.keys(version.dependencies)) : null;
|
const dependencies = version.dependencies ? trimArray(Object.keys(version.dependencies)) : null;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ module.exports = class MockingCommand extends Command {
|
|||||||
|
|
||||||
run(msg, { text }) {
|
run(msg, { text }) {
|
||||||
for (let i = 0; i < text.length; i += Math.floor(Math.random() * 4)) text[i] = text[i].toUpperCase();
|
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
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "60.2.0",
|
"version": "60.2.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ class EmojiArgumentType extends ArgumentType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
validate(value, msg) {
|
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 (matches && msg.client.emojis.has(matches[2])) return true;
|
||||||
if (!msg.guild) return false;
|
if (!msg.guild) return false;
|
||||||
const search = value.toLowerCase();
|
const search = value.toLowerCase();
|
||||||
|
|||||||
Reference in New Issue
Block a user