mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 21:44:48 +02:00
Update NPM
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
const { Command } = require('discord.js-commando');
|
const { Command } = require('discord.js-commando');
|
||||||
const { MessageEmbed } = require('discord.js');
|
const { MessageEmbed } = require('discord.js');
|
||||||
const snekfetch = require('snekfetch');
|
const snekfetch = require('snekfetch');
|
||||||
const { shorten } = require('../../util/Util');
|
|
||||||
|
|
||||||
module.exports = class NPMCommand extends Command {
|
module.exports = class NPMCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -10,14 +9,14 @@ module.exports = class NPMCommand extends Command {
|
|||||||
aliases: ['npm-package'],
|
aliases: ['npm-package'],
|
||||||
group: 'search',
|
group: 'search',
|
||||||
memberName: 'npm',
|
memberName: 'npm',
|
||||||
description: 'Searches NPM for info on an NPM package.',
|
description: 'Gets information on an NPM package.',
|
||||||
clientPermissions: ['EMBED_LINKS'],
|
clientPermissions: ['EMBED_LINKS'],
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'query',
|
key: 'query',
|
||||||
prompt: 'What package would you like to search for?',
|
prompt: 'What package would you like to get information on?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
parse: query => encodeURIComponent(query)
|
parse: query => encodeURIComponent(query.replace(/ /g, '-'))
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -44,7 +43,7 @@ module.exports = class NPMCommand extends Command {
|
|||||||
.setAuthor('NPM', 'https://i.imgur.com/ErKf5Y0.png')
|
.setAuthor('NPM', 'https://i.imgur.com/ErKf5Y0.png')
|
||||||
.setTitle(body.name)
|
.setTitle(body.name)
|
||||||
.setURL(`https://www.npmjs.com/package/${query}`)
|
.setURL(`https://www.npmjs.com/package/${query}`)
|
||||||
.setDescription(body.description ? shorten(body.description) : 'No description.')
|
.setDescription(body.description || 'No description.')
|
||||||
.addField('❯ Version',
|
.addField('❯ Version',
|
||||||
body['dist-tags'].latest, true)
|
body['dist-tags'].latest, true)
|
||||||
.addField('❯ License',
|
.addField('❯ License',
|
||||||
@@ -56,9 +55,9 @@ module.exports = class NPMCommand extends Command {
|
|||||||
.addField('❯ Modified',
|
.addField('❯ Modified',
|
||||||
new Date(body.time.modified).toDateString(), true)
|
new Date(body.time.modified).toDateString(), true)
|
||||||
.addField('❯ Main File',
|
.addField('❯ Main File',
|
||||||
version.main, true)
|
version.main || '???', true)
|
||||||
.addField('❯ Dependencies',
|
.addField('❯ Dependencies',
|
||||||
dependencies ? dependencies.join(', ') : 'None')
|
dependencies && dependencies.length ? dependencies.join(', ') : 'None')
|
||||||
.addField('❯ Maintainers',
|
.addField('❯ Maintainers',
|
||||||
maintainers.join(', '));
|
maintainers.join(', '));
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
|
|||||||
Reference in New Issue
Block a user