Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async onMemberUnban(_, user) {
const relevantAuditLogEntry = await this.findRelevantAuditLogEntry(
ErisConstants.AuditLogActions.MEMBER_BAN_REMOVE,
user.id,
);
const mod = relevantAuditLogEntry ? relevantAuditLogEntry.user : new UnknownUser();
this.guildLogs.log(
LogType.MEMBER_UNBAN,
{
mod: stripObjectToScalars(mod),
userId: user.id,
},
user.id,
);
}
async onGuildBanAdd(guild: Guild, user: User) {
if (this.isEventIgnored(IgnoredEventType.Ban, user.id)) {
this.clearIgnoredEvent(IgnoredEventType.Ban, user.id);
return;
}
const relevantAuditLogEntry = await this.findRelevantAuditLogEntry(
ErisConstants.AuditLogActions.MEMBER_BAN_ADD,
user.id,
);
const casesPlugin = this.getPlugin("cases");
if (relevantAuditLogEntry) {
const modId = relevantAuditLogEntry.user.id;
const auditLogId = relevantAuditLogEntry.id;
casesPlugin.createCase({
userId: user.id,
modId,
type: CaseTypes.Ban,
auditLogId,
reason: relevantAuditLogEntry.reason,
automatic: true,
});