diff --git a/Events/MessageEvent.cs b/Events/MessageEvent.cs index 209e473a..e39c843a 100644 --- a/Events/MessageEvent.cs +++ b/Events/MessageEvent.cs @@ -144,21 +144,24 @@ public static async Task MessageHandlerAsync(DiscordClient client, MockDiscordMe { // Check current channel against tracking channels var trackingChannels = await Program.db.HashGetAsync("trackingChannels", message.Author.Id); - var trackingChannelsList = JsonConvert.DeserializeObject>(trackingChannels); - if (trackingChannelsList.Count > 0) + if (trackingChannels.HasValue) { - // This user's tracking is filtered to channels; check the channel before relaying the msg to the tracking thread - var channels = JsonConvert.DeserializeObject>(trackingChannels); - if (channels.Contains(channel.Id) || channels.Contains(channel.Parent.Id)) + var trackingChannelsList = JsonConvert.DeserializeObject>(trackingChannels); + if (trackingChannelsList.Count > 0) { + // This user's tracking is filtered to channels; check the channel before relaying the msg to the tracking thread + var channels = JsonConvert.DeserializeObject>(trackingChannels); + if (channels.Contains(channel.Id) || channels.Contains(channel.Parent.Id)) + { + await RelayTrackedMessageAsync(client, message); + } + } + else + { + // This user's tracking is not filtered to channels, so just relay the msg to the tracking thread await RelayTrackedMessageAsync(client, message); } } - else - { - // This user's tracking is not filtered to channels, so just relay the msg to the tracking thread - await RelayTrackedMessageAsync(client, message); - } } if (!isAnEdit && channel.IsPrivate && Program.cfgjson.LogChannels.ContainsKey("dms"))