Remove message group limit setting

This commit is contained in:
Alexey Golub
2019-03-07 21:14:11 +02:00
parent 9b78472e05
commit 33f71c1612
9 changed files with 3 additions and 31 deletions

View File

@@ -18,14 +18,12 @@ namespace DiscordChatExporter.Core.Services
private readonly ExportFormat _format;
private readonly ChatLog _log;
private readonly string _dateFormat;
private readonly int _messageGroupLimit;
public TemplateModel(ExportFormat format, ChatLog log, string dateFormat, int messageGroupLimit)
public TemplateModel(ExportFormat format, ChatLog log, string dateFormat)
{
_format = format;
_log = log;
_dateFormat = dateFormat;
_messageGroupLimit = messageGroupLimit;
}
private IEnumerable<MessageGroup> GroupMessages(IEnumerable<Message> messages)
@@ -39,8 +37,7 @@ namespace DiscordChatExporter.Core.Services
buffer.Any() &&
(
message.Author.Id != buffer.First().Author.Id || // when author changes
(message.Timestamp - buffer.Last().Timestamp).TotalMinutes > 7 || // when more than 7 minutes passed since last message
buffer.Count >= _messageGroupLimit // when group is full
(message.Timestamp - buffer.Last().Timestamp).TotalMinutes > 7 // when more than 7 minutes passed since last message
);
// If condition is true - flush buffer

View File

@@ -36,8 +36,7 @@ namespace DiscordChatExporter.Core.Services
};
// Create template model
var templateModel = new TemplateModel(format, chatLog,
_settingsService.DateFormat, _settingsService.MessageGroupLimit);
var templateModel = new TemplateModel(format, chatLog, _settingsService.DateFormat);
context.PushGlobal(templateModel.GetScriptObject());

View File

@@ -8,7 +8,6 @@ namespace DiscordChatExporter.Core.Services
public bool IsAutoUpdateEnabled { get; set; } = true;
public string DateFormat { get; set; } = "dd-MMM-yy hh:mm tt";
public int MessageGroupLimit { get; set; } = 20;
public AuthToken LastToken { get; set; }
public ExportFormat LastExportFormat { get; set; } = ExportFormat.HtmlDark;