Set ChatLog.TotalMessageCount from ChatLogService

pull/116/head
Oleksii Holub 6 years ago
parent 95a4217ab3
commit bcad5b4ed1

@ -16,18 +16,19 @@ namespace DiscordChatExporter.Core.Models
public IReadOnlyList<MessageGroup> 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<MessageGroup> messageGroups, Mentionables mentionables)
IReadOnlyList<MessageGroup> messageGroups, long totalMessageCount, Mentionables mentionables)
{
Guild = guild;
Channel = channel;
From = from;
To = to;
MessageGroups = messageGroups;
TotalMessageCount = totalMessageCount;
Mentionables = mentionables;
}

@ -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<ChatLog> GetChatLogAsync(AuthToken token, string channelId,

Loading…
Cancel
Save