mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 13:56:25 +02:00
Add features from Auto
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { js_beautify: beautify } = require('js-beautify');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
module.exports = class BeautifyCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'beautify',
|
||||
aliases: ['js-beautify'],
|
||||
group: 'code',
|
||||
memberName: 'lint',
|
||||
description: 'Beautifies code with js-beautify.',
|
||||
clientPermissions: ['READ_MESSAGE_HISTORY'],
|
||||
args: [
|
||||
{
|
||||
key: 'code',
|
||||
prompt: 'What code do you want to beautify?',
|
||||
type: 'code'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { code }) {
|
||||
return msg.reply(stripIndents`
|
||||
\`\`\`${code.lang || 'js'}
|
||||
${beautify(code.code)}
|
||||
\`\`\`
|
||||
`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user