Add support for custom emojis

Closes #14
This commit is contained in:
Alexey Golub 2017-10-25 23:31:32 +03:00
parent 2c0a63352c
commit 1d7264a71b
3 changed files with 16 additions and 0 deletions

View file

@ -116,4 +116,10 @@ div.msg-attachment {
img.msg-attachment { img.msg-attachment {
max-height: 500px; max-height: 500px;
max-width: 50%; max-width: 50%;
}
img.emoji {
height: 24px;
width: 24px;
vertical-align: -.4em;
} }

View file

@ -114,4 +114,10 @@ div.msg-attachment {
img.msg-attachment { img.msg-attachment {
max-height: 500px; max-height: 500px;
max-width: 50%; max-width: 50%;
}
img.emoji {
height: 24px;
width: 24px;
vertical-align: -.4em;
} }

View file

@ -248,6 +248,10 @@ namespace DiscordChatExporter.Services
// New lines // New lines
content = content.Replace("\n", "<br />"); content = content.Replace("\n", "<br />");
// Custom emojis (<:name:id>)
content = Regex.Replace(content, "&lt;:.*?:(\\d+)&gt;",
"<img class=\"emoji\" src=\"https://cdn.discordapp.com/emojis/$1.png\" />");
return content; return content;
} }
} }