galactic-bot/structure/moderation/infractions/Unlockdown.js

48 lines
1.1 KiB
JavaScript

const { Infraction } = require('../interfaces/');
class UnlockdownInfraction extends Infraction {
static type = 'UNLOCKDOWN';
constructor(client, opts = {}) {
super(client, {
targetType: 'CHANNEL',
type: opts.type,
message: opts.message,
executor: opts.executor.user,
target: opts.target.user,
reason: opts.reason,
guild: opts.guild,
channel: opts.channel,
arguments: opts.arguments,
silent: opts.silent,
data: opts.data,
hyperlink: opts.hyperlink
});
this.client = client;
}
async execute() {
const callback = await this.client.moderationManager.callbacks.filter((c) => {
return c.infraction.type === this.type
&& c.infraction.target === this.targetId;
}).first();
if(!callback) await this.handle();
return this._succeed();
}
async verify() {
return super._verify();
}
}
module.exports = UnlockdownInfraction;