2020-06-02 12:09:28 +02:00
|
|
|
const { Infraction } = require('../interfaces/');
|
|
|
|
|
|
|
|
class Kick extends Infraction {
|
|
|
|
|
|
|
|
constructor(client, opts = {}) {
|
|
|
|
|
|
|
|
super(client, {
|
|
|
|
type: 'KICK',
|
|
|
|
targetType: 'user',
|
|
|
|
message: opts.message,
|
|
|
|
executor: opts.executor.user,
|
|
|
|
target: opts.target.user,
|
|
|
|
reason: opts.reason || 'N/A',
|
|
|
|
guild: opts.guild,
|
|
|
|
channel: opts.channel,
|
|
|
|
arguments: opts.arguments,
|
2020-06-04 19:59:09 +02:00
|
|
|
silent: opts.silent,
|
2020-07-04 12:23:10 +02:00
|
|
|
color: 0xff7a33,
|
2020-06-02 12:09:28 +02:00
|
|
|
dictionary: {
|
|
|
|
past: 'kicked',
|
|
|
|
present: 'kick'
|
2020-07-16 09:54:39 +02:00
|
|
|
},
|
|
|
|
points: opts.points,
|
|
|
|
expiration: opts.expiration,
|
|
|
|
data: opts.data
|
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-16 09:54:39 +02:00
|
|
|
verify() {
|
|
|
|
|
|
|
|
if(!this.member.kickable) return this._fail('C_KICK_INSUFFICIENTPERMISSIONS');
|
|
|
|
return super._verify();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-06-02 12:09:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Kick;
|