Add support for Guild Member object & included data (#279)

This commit is contained in:
Will Kennedy
2020-03-26 08:36:55 -04:00
committed by GitHub
parent 7bb8038ce9
commit 79e43c4144
10 changed files with 118 additions and 29 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
@@ -114,8 +115,9 @@ namespace DiscordChatExporter.Core.Rendering.Logic
{
var role = context.MentionableRoles.FirstOrDefault(r => r.Id == mentionNode.Id) ??
Role.CreateDeletedRole(mentionNode.Id);
return $"<span class=\"mention\">@{HtmlEncode(role.Name)}</span>";
string style = "";
if (role.Color != Color.Black) style = $"style=\"color: {role.ColorAsHex}; background-color: rgba({role.ColorAsRgb}, 0.1); font-weight: 400;\"";
return $"<span class=\"mention\" {style}>@{HtmlEncode(role.Name)}</span>";
}
}