Skip to content

Commit 4aa22fa

Browse files
Fix message tracking
1 parent f8ea1c6 commit 4aa22fa

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

Events/MessageEvent.cs

+9-11
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,19 @@ public static async Task MessageHandlerAsync(DiscordClient client, MockDiscordMe
147147
if (trackingChannels.HasValue)
148148
{
149149
var trackingChannelsList = JsonConvert.DeserializeObject<List<ulong>>(trackingChannels);
150-
if (trackingChannelsList.Count > 0)
150+
151+
// Relay if this user's tracking is not filtered to any channels, or if this msg is in a channel the tracking is filtered to
152+
var channels = JsonConvert.DeserializeObject<List<ulong>>(trackingChannels);
153+
if (trackingChannelsList.Count == 0 || channels.Contains(channel.Id) || channels.Contains(channel.Parent.Id))
151154
{
152-
// This user's tracking is filtered to channels; check the channel before relaying the msg to the tracking thread
153-
var channels = JsonConvert.DeserializeObject<List<ulong>>(trackingChannels);
154-
if (channels.Contains(channel.Id) || channels.Contains(channel.Parent.Id))
155-
{
156-
await RelayTrackedMessageAsync(client, message);
157-
}
158-
}
159-
else
160-
{
161-
// This user's tracking is not filtered to channels, so just relay the msg to the tracking thread
162155
await RelayTrackedMessageAsync(client, message);
163156
}
164157
}
158+
else
159+
{
160+
// This user's tracking is not filtered to channels, so just relay the msg to the tracking thread
161+
await RelayTrackedMessageAsync(client, message);
162+
}
165163
}
166164

167165
if (!isAnEdit && channel.IsPrivate && Program.cfgjson.LogChannels.ContainsKey("dms"))

0 commit comments

Comments
 (0)