Haha-Yes/commands/admin/bye.js

39 lines
1 KiB
JavaScript
Raw Normal View History

const { Command } = require('discord-akairo');
const fs = require('fs');
class byeCommand extends Command {
constructor() {
super('bye', {
aliases: ['bye'],
category: 'admin',
channelRestriction: 'guild',
userPermissions: ['MANAGE_CHANNELS'],
args: [
{
id: 'message',
type: 'string',
match: 'rest'
}
],
description: {
2019-05-11 18:34:19 +02:00
content: 'Send a message to the current channel when a person leave, you can use [member] to show the member username and [server] to show the name of the server',
usage: '[bye message]',
2019-05-10 16:38:44 +02:00
examples: ['[member] leaved the server, he deserve a ban']
}
});
}
async exec(message, args) {
let byeChannel = message.channel.id;
fs.writeFile(`./bye/${message.guild.id}.json`, `{"channel": "${byeChannel}", "message": "${args.message}"}`, function (err) {
if (err) {
console.log(err);
}
});
return message.channel.send(`This channel will now be used to send message when user leave with the following message: ${args.message}`);
}
}
module.exports = byeCommand;