[HTML] Split message group if usernames are different

Closes #290
This commit is contained in:
Alexey Golub 2020-04-17 18:47:06 +03:00
parent de9e7caaeb
commit 6f1c944cb3
2 changed files with 6 additions and 2 deletions

View file

@ -2,7 +2,7 @@
namespace DiscordChatExporter.Core.Models
{
// https://discordapp.com/developers/docs/topics/permissions#role-object
// https://discordapp.com/developers/docs/resources/user#user-object
public partial class User : IHasId
{

View file

@ -15,7 +15,11 @@ namespace DiscordChatExporter.Core.Rendering.Logic
{
public static bool CanBeGrouped(Message message1, Message message2)
{
if (message1.Author.Id != message2.Author.Id)
if (!string.Equals(message1.Author.Id, message2.Author.Id, StringComparison.Ordinal))
return false;
// Bots can post message under different usernames, so need to check this too
if (!string.Equals(message1.Author.FullName, message2.Author.FullName, StringComparison.Ordinal))
return false;
if ((message2.Timestamp - message1.Timestamp).Duration().TotalMinutes > 7)