mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Add npm packages to credits
This commit is contained in:
@@ -4,7 +4,7 @@ const moment = require('moment');
|
||||
require('moment-duration-format');
|
||||
const { formatNumber, embedURL } = require('../../util/Util');
|
||||
const { version, dependencies, optionalDependencies } = require('../../package');
|
||||
const deps = { ...dependencies, ...optionalDependencies };
|
||||
const deps = Object.keys({ ...dependencies, ...optionalDependencies }).sort();
|
||||
const copyright = require('../../assets/json/copyright');
|
||||
|
||||
module.exports = class InfoCommand extends Command {
|
||||
@@ -39,7 +39,7 @@ module.exports = class InfoCommand extends Command {
|
||||
.addField('❯ Node.js', process.version, true)
|
||||
.addField('❯ Discord.js', `v${djsVersion}`, true)
|
||||
.addField('❯ Framework', 'Custom', true)
|
||||
.addField('❯ Dependencies', Object.keys(deps).sort().join(', '));
|
||||
.addField('❯ Dependencies', deps.join(', '));
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { dependencies, optionalDependencies } = require('../../package');
|
||||
const deps = Object.keys({ ...dependencies, ...optionalDependencies }).sort();
|
||||
|
||||
module.exports = class GenerateCreditCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -15,6 +17,7 @@ module.exports = class GenerateCreditCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const npm = `* ${deps.map(dep => `[${dep}](https://registry.npmjs.com/${dep})`).join('* \n')}`;
|
||||
const list = this.client.registry.groups
|
||||
.map(g => {
|
||||
const commands = g.commands.filter(c => !c.hidden && !c.ownerOnly && c.credit.length - 1 !== 0);
|
||||
@@ -27,7 +30,8 @@ module.exports = class GenerateCreditCommand extends Command {
|
||||
}).join('\n');
|
||||
})
|
||||
.filter(cmds => cmds);
|
||||
await msg.direct({ files: [{ attachment: Buffer.from(list.join('\n')), name: 'credits.txt' }] });
|
||||
const file = Buffer.from(`# Credits\n## NPM Packages\n${npm}\n## Other Credits${list.join('\n')}`);
|
||||
await msg.direct({ files: [{ attachment: file, name: 'credits.txt' }] });
|
||||
return msg.say('📬 Sent `credits.txt` to your DMs!');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user