modmail/structure/commands/Reply.js

31 lines
804 B
JavaScript
Raw Normal View History

2021-06-19 15:06:20 +02:00
const Command = require('../Command');
class Reply extends Command {
2021-10-22 09:35:04 +02:00
constructor (client) {
2021-06-19 15:06:20 +02:00
super(client, {
name: 'reply',
2021-10-22 09:35:04 +02:00
aliases: [ 'r' ],
2021-06-19 15:06:20 +02:00
showUsage: true,
usage: `<reply content>`
});
}
2021-10-22 09:35:04 +02:00
async execute (message, { args }) {
2021-06-19 15:06:20 +02:00
2021-10-22 09:35:04 +02:00
const [ first ] = args.map((a) => a);
2021-06-19 15:06:20 +02:00
// eslint-disable-next-line prefer-const
let { content, _caller } = message,
anon = false;
content = content.replace(`${this.client.prefix}${_caller}`, '');
if (first.toLowerCase() === 'anon') {
anon = true;
content = content.replace(first, '');
}
return this.client.modmail.sendResponse({ message, content: content.trim(), anon });
}
}
module.exports = Reply;