39 lines
1 KiB
JavaScript
39 lines
1 KiB
JavaScript
|
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: {
|
||
|
content: 'Set bye message when user leave/get kicked, can use [member] to get the name of the user joining and [server] to get the name of the server',
|
||
|
usage: '[bye message]',
|
||
|
examples: ['everyone bye [adjectives] [member] and bye on [server]']
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
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;
|