2020-06-02 12:09:28 +02:00
|
|
|
const { Infraction } = require('../interfaces/');
|
|
|
|
|
2020-07-30 14:41:17 +02:00
|
|
|
class KickInfraction extends Infraction {
|
2020-06-02 12:09:28 +02:00
|
|
|
|
2021-06-16 06:49:17 +02:00
|
|
|
static type = 'KICK';
|
|
|
|
|
2020-06-02 12:09:28 +02:00
|
|
|
constructor(client, opts = {}) {
|
2021-06-16 06:49:17 +02:00
|
|
|
|
2020-06-02 12:09:28 +02:00
|
|
|
super(client, {
|
2021-05-10 22:09:03 +02:00
|
|
|
targetType: 'USER',
|
2021-06-16 08:50:01 +02:00
|
|
|
type: opts.type,
|
2020-06-02 12:09:28 +02:00
|
|
|
message: opts.message,
|
|
|
|
executor: opts.executor.user,
|
|
|
|
target: opts.target.user,
|
2021-05-10 22:09:03 +02:00
|
|
|
reason: opts.reason,
|
2020-06-02 12:09:28 +02:00
|
|
|
guild: opts.guild,
|
|
|
|
channel: opts.channel,
|
|
|
|
arguments: opts.arguments,
|
2020-06-04 19:59:09 +02:00
|
|
|
silent: opts.silent,
|
2020-07-16 09:54:39 +02:00
|
|
|
points: opts.points,
|
|
|
|
expiration: opts.expiration,
|
2021-06-26 08:42:57 +02:00
|
|
|
data: opts.data,
|
|
|
|
hyperlink: opts.hyperlink
|
2020-06-02 12:09:28 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
this.client = client;
|
|
|
|
this.member = opts.target;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
async execute() {
|
|
|
|
|
|
|
|
try {
|
2020-07-04 12:23:10 +02:00
|
|
|
await this.member.kick(this._reason);
|
2020-06-02 12:09:28 +02:00
|
|
|
} catch(error) {
|
|
|
|
return this._fail('INFRACTION_ERROR');
|
|
|
|
}
|
|
|
|
|
2020-07-04 12:23:10 +02:00
|
|
|
await this.handle();
|
2020-06-02 12:09:28 +02:00
|
|
|
return this._succeed();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-07-29 21:01:39 +02:00
|
|
|
async verify() {
|
2020-07-20 00:42:21 +02:00
|
|
|
|
|
|
|
if(!this.member.kickable) return this._fail('C_KICK_CANNOTBEKICKED');
|
2020-07-16 09:54:39 +02:00
|
|
|
return super._verify();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-06-02 12:09:28 +02:00
|
|
|
}
|
|
|
|
|
2020-07-30 14:41:17 +02:00
|
|
|
module.exports = KickInfraction;
|