2020-04-17 09:03:53 +02:00
|
|
|
const { Infraction } = require('../interfaces/');
|
|
|
|
|
2020-07-30 14:41:17 +02:00
|
|
|
class WarnInfraction extends Infraction {
|
2020-04-17 09:03:53 +02:00
|
|
|
|
|
|
|
constructor(client, opts = {}) {
|
|
|
|
|
|
|
|
super(client, {
|
|
|
|
type: 'WARN',
|
|
|
|
targetType: 'user',
|
2020-07-04 12:23:10 +02:00
|
|
|
message: opts.message,
|
2020-04-17 09:03:53 +02:00
|
|
|
executor: opts.executor.user,
|
|
|
|
target: opts.target.user,
|
|
|
|
reason: opts.reason || 'N/A',
|
|
|
|
guild: opts.guild,
|
|
|
|
channel: opts.channel,
|
2020-07-04 12:23:10 +02:00
|
|
|
silent: opts.silent,
|
|
|
|
color: 0xffe15c,
|
2020-04-17 09:03:53 +02:00
|
|
|
dictionary: {
|
|
|
|
past: 'warned',
|
|
|
|
present: 'warn'
|
2020-07-16 09:54:39 +02:00
|
|
|
},
|
|
|
|
points: opts.points,
|
|
|
|
expiration: opts.expiration,
|
|
|
|
data: opts.data
|
2020-04-17 09:03:53 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
this.client = client;
|
|
|
|
|
|
|
|
this.member = opts.target;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-07-04 12:23:10 +02:00
|
|
|
async execute() {
|
|
|
|
await this.handle();
|
|
|
|
return this._succeed();
|
2020-04-17 09:03:53 +02:00
|
|
|
}
|
|
|
|
|
2020-07-28 22:40:15 +02:00
|
|
|
async verify() {
|
|
|
|
|
2020-07-29 21:01:39 +02:00
|
|
|
const permissions = await this.client.moderationManager.permissions.execute(this.message, this.message.command);
|
|
|
|
if(permissions.error) return super._fail('C_WARN_INSUFFICIENTPERMISSIONS');
|
|
|
|
|
2020-07-28 22:40:15 +02:00
|
|
|
|
|
|
|
return super._verify();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-17 09:03:53 +02:00
|
|
|
}
|
|
|
|
|
2020-07-30 14:41:17 +02:00
|
|
|
module.exports = WarnInfraction;
|