diff --git a/DiscordChatExporter.Core/Models/ChatLog.cs b/DiscordChatExporter.Core/Models/ChatLog.cs index a5c38f0..aa8c476 100644 --- a/DiscordChatExporter.Core/Models/ChatLog.cs +++ b/DiscordChatExporter.Core/Models/ChatLog.cs @@ -16,18 +16,19 @@ namespace DiscordChatExporter.Core.Models public IReadOnlyList MessageGroups { get; } - public int TotalMessageCount => MessageGroups.Sum(g => g.Messages.Count); + public long TotalMessageCount { get; } public Mentionables Mentionables { get; } public ChatLog(Guild guild, Channel channel, DateTime? from, DateTime? to, - IReadOnlyList messageGroups, Mentionables mentionables) + IReadOnlyList messageGroups, long totalMessageCount, Mentionables mentionables) { Guild = guild; Channel = channel; From = from; To = to; MessageGroups = messageGroups; + TotalMessageCount = totalMessageCount; Mentionables = mentionables; } diff --git a/DiscordChatExporter.Core/Services/ChatLogService.cs b/DiscordChatExporter.Core/Services/ChatLogService.cs index 5592847..2bd4695 100644 --- a/DiscordChatExporter.Core/Services/ChatLogService.cs +++ b/DiscordChatExporter.Core/Services/ChatLogService.cs @@ -24,10 +24,13 @@ namespace DiscordChatExporter.Core.Services // Group messages var messageGroups = _messageGroupService.GroupMessages(messages); + // Get total message count + var totalMessageCount = messages.Count; + // Get mentionables var mentionables = await _dataService.GetMentionablesAsync(token, guild.Id, messages); - return new ChatLog(guild, channel, from, to, messageGroups, mentionables); + return new ChatLog(guild, channel, from, to, messageGroups, totalMessageCount, mentionables); } public async Task GetChatLogAsync(AuthToken token, string channelId,