From d3dbb9f479cfd12a1dd8adb73a849417d6e8639d Mon Sep 17 00:00:00 2001 From: Dragory Date: Tue, 31 Jul 2018 20:23:33 +0300 Subject: [PATCH] fix(logs): use log type strings for include/exclude --- src/plugins/Logs.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/Logs.ts b/src/plugins/Logs.ts index 74c3862d..6307fbe1 100644 --- a/src/plugins/Logs.ts +++ b/src/plugins/Logs.ts @@ -10,8 +10,8 @@ import isEqual from "lodash.isequal"; import diff from "lodash.difference"; interface ILogChannel { - include?: LogType[]; - exclude?: LogType[]; + include?: string[]; + exclude?: string[]; } interface ILogChannelMap { @@ -53,13 +53,15 @@ export class LogsPlugin extends Plugin { async log(type, data) { const logChannels: ILogChannelMap = this.configValue("channels"); + const typeStr = LogType[type]; + for (const [channelId, opts] of Object.entries(logChannels)) { const channel = this.guild.channels.get(channelId); if (!channel || !(channel instanceof TextChannel)) continue; if ( - (opts.include && opts.include.includes(type)) || - (opts.exclude && !opts.exclude.includes(type)) + (opts.include && opts.include.includes(typeStr)) || + (opts.exclude && !opts.exclude.includes(typeStr)) ) { const message = this.getLogMessage(type, data); if (message) await channel.createMessage(message);