3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-18 07:35:02 +00:00

Add custom argument types for deep-resolved users/members, use these in some places. Deprecate unknownUser (constant) and replace with instances of UnknownUser (class).

This commit is contained in:
Dragory 2019-04-20 19:03:30 +03:00
parent 2d690da92b
commit ab83e83d42
6 changed files with 151 additions and 111 deletions

View file

@ -10,7 +10,7 @@ import {
findRelevantAuditLogEntry,
noop,
stripObjectToScalars,
unknownUser,
UnknownUser,
useMediaUrls,
} from "../utils";
import DefaultLogMessages from "../data/DefaultLogMessages.json";
@ -256,7 +256,7 @@ export class LogsPlugin extends ZeppelinPlugin<ILogsPluginConfig> {
ErisConstants.AuditLogActions.MEMBER_BAN_ADD,
user.id,
);
const mod = relevantAuditLogEntry ? relevantAuditLogEntry.user : unknownUser;
const mod = relevantAuditLogEntry ? relevantAuditLogEntry.user : new UnknownUser();
this.guildLogs.log(
LogType.MEMBER_BAN,
@ -275,7 +275,7 @@ export class LogsPlugin extends ZeppelinPlugin<ILogsPluginConfig> {
ErisConstants.AuditLogActions.MEMBER_BAN_REMOVE,
user.id,
);
const mod = relevantAuditLogEntry ? relevantAuditLogEntry.user : unknownUser;
const mod = relevantAuditLogEntry ? relevantAuditLogEntry.user : new UnknownUser();
this.guildLogs.log(
LogType.MEMBER_UNBAN,
@ -308,7 +308,7 @@ export class LogsPlugin extends ZeppelinPlugin<ILogsPluginConfig> {
ErisConstants.AuditLogActions.MEMBER_ROLE_UPDATE,
member.id,
);
const mod = relevantAuditLogEntry ? relevantAuditLogEntry.user : unknownUser;
const mod = relevantAuditLogEntry ? relevantAuditLogEntry.user : new UnknownUser();
if (addedRoles.length && removedRoles.length) {
// Roles added *and* removed