Fix logs crash

This commit is contained in:
Dragory 2020-07-30 13:40:34 +03:00
parent 8082752cba
commit 9125dba2ab
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 3 additions and 3 deletions

View file

@ -52,8 +52,6 @@ export interface LogsPluginType extends BasePluginType {
onMessageDeleteFn;
onMessageDeleteBulkFn;
onMessageUpdateFn;
excludedUserProps: string[];
};
}

View file

@ -5,6 +5,8 @@ import { TextChannel } from "eris";
import { createChunkedMessage, noop } from "src/utils";
import { getLogMessage } from "./getLogMessage";
const excludedUserProps = ["user", "member", "mod"];
export async function log(pluginData: PluginData<LogsPluginType>, type: LogType, data: any) {
const logChannels: TLogChannelMap = pluginData.config.get().channels;
const typeStr = LogType[type];
@ -17,7 +19,7 @@ export async function log(pluginData: PluginData<LogsPluginType>, type: LogType,
// If this log entry is about an excluded user, skip it
// TODO: Quick and dirty solution, look into changing at some point
if (opts.excluded_users) {
for (const prop of pluginData.state.excludedUserProps) {
for (const prop of excludedUserProps) {
if (data && data[prop] && opts.excluded_users.includes(data[prop].id)) {
continue logChannelLoop;
}