2019-08-11 19:54:41 +02:00
|
|
|
const { Command } = require('discord-akairo');
|
2020-02-18 18:36:21 +01:00
|
|
|
const leaveChannel = require('../../models').leaveChannel;
|
2019-08-11 19:54:41 +02:00
|
|
|
|
|
|
|
class fakeleaveCommand extends Command {
|
|
|
|
constructor() {
|
|
|
|
super('fakeleave', {
|
|
|
|
aliases: ['fakeleave'],
|
|
|
|
category: 'admin',
|
2020-03-19 23:24:31 +01:00
|
|
|
channel: 'guild',
|
2019-11-22 20:56:54 +01:00
|
|
|
clientPermissions: ['SEND_MESSAGES', 'ATTACH_FILES'],
|
2019-08-11 19:54:41 +02:00
|
|
|
args: [
|
|
|
|
{
|
2019-12-16 17:34:57 +01:00
|
|
|
id: 'user',
|
2019-08-11 19:59:46 +02:00
|
|
|
type: 'user',
|
2019-08-11 19:54:41 +02:00
|
|
|
match: 'rest'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
description: {
|
|
|
|
content: 'Fake leave message',
|
|
|
|
usage: '[user]',
|
|
|
|
examples: ['Supositware']
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async exec(message, args) {
|
2019-12-16 17:34:57 +01:00
|
|
|
let member;
|
2020-02-18 18:36:21 +01:00
|
|
|
const leave = await leaveChannel.findOne({where: {guildID: message.guild.id}});
|
|
|
|
|
|
|
|
if (leave) {
|
|
|
|
if (args.user)
|
2020-03-04 02:08:04 +01:00
|
|
|
member = message.guild.members.resolve(args.user.id);
|
2020-02-18 18:36:21 +01:00
|
|
|
else
|
2020-03-04 02:08:04 +01:00
|
|
|
member = message.guild.members.resolve(message.author.id);
|
2020-02-18 18:36:21 +01:00
|
|
|
} else {
|
2021-07-23 04:19:47 +02:00
|
|
|
return message.reply('There is no leave channel setup');
|
2020-02-18 18:36:21 +01:00
|
|
|
}
|
2019-08-11 19:54:41 +02:00
|
|
|
|
2019-12-16 17:34:57 +01:00
|
|
|
this.client.emit('guildMemberRemove', member);
|
2019-08-11 19:54:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = fakeleaveCommand;
|