mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-23 19:26:57 -04:00
Set ChatLog.TotalMessageCount from ChatLogService
This commit is contained in:
parent
95a4217ab3
commit
bcad5b4ed1
2 changed files with 7 additions and 3 deletions
|
@ -16,18 +16,19 @@ namespace DiscordChatExporter.Core.Models
|
||||||
|
|
||||||
public IReadOnlyList<MessageGroup> MessageGroups { get; }
|
public IReadOnlyList<MessageGroup> MessageGroups { get; }
|
||||||
|
|
||||||
public int TotalMessageCount => MessageGroups.Sum(g => g.Messages.Count);
|
public long TotalMessageCount { get; }
|
||||||
|
|
||||||
public Mentionables Mentionables { get; }
|
public Mentionables Mentionables { get; }
|
||||||
|
|
||||||
public ChatLog(Guild guild, Channel channel, DateTime? from, DateTime? to,
|
public ChatLog(Guild guild, Channel channel, DateTime? from, DateTime? to,
|
||||||
IReadOnlyList<MessageGroup> messageGroups, Mentionables mentionables)
|
IReadOnlyList<MessageGroup> messageGroups, long totalMessageCount, Mentionables mentionables)
|
||||||
{
|
{
|
||||||
Guild = guild;
|
Guild = guild;
|
||||||
Channel = channel;
|
Channel = channel;
|
||||||
From = from;
|
From = from;
|
||||||
To = to;
|
To = to;
|
||||||
MessageGroups = messageGroups;
|
MessageGroups = messageGroups;
|
||||||
|
TotalMessageCount = totalMessageCount;
|
||||||
Mentionables = mentionables;
|
Mentionables = mentionables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,13 @@ namespace DiscordChatExporter.Core.Services
|
||||||
// Group messages
|
// Group messages
|
||||||
var messageGroups = _messageGroupService.GroupMessages(messages);
|
var messageGroups = _messageGroupService.GroupMessages(messages);
|
||||||
|
|
||||||
|
// Get total message count
|
||||||
|
var totalMessageCount = messages.Count;
|
||||||
|
|
||||||
// Get mentionables
|
// Get mentionables
|
||||||
var mentionables = await _dataService.GetMentionablesAsync(token, guild.Id, messages);
|
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,
|
public async Task<ChatLog> GetChatLogAsync(AuthToken token, string channelId,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue