Expose custom emoji URL when used in a message
The custom emoji is shown with it's full image in the HTML output, but in the JSON output there is no way to find the url of the custom emoji.
I will work on this issue.
I just checked, and I see full urls when doing a json output. It doesn't seem to be bugged. It appears to work correctly for me. Please find attached two examples. discord_export_example.zip
@Gladuin can you clarify?
@Gladuin can you clarify?
In the HTML output, custom emojis are shown in the message as an image, like a normal emoji. However, in the JSON output, custom emojis are shown as (example) :longcat:, with no way of getting the custom emoji's URL / image.
Hmm. That would be because the emojis are parsed separately. The only way to solve this that I can see is by adding something like:
"message": {
"content": "Message with custom emoji :longcat:",
"emojiMap": {
":longcat:": "url"
}
}
Hmm. That would be because the emojis are parsed separately. The only way to solve this that I can see is by adding something like:
"message": { "content": "Message with custom emoji :longcat:", "emojiMap": { ":longcat:": "url" } }
I had something like this in mind too
Any update on this? Just noticed this myself. The problem is that all emoji have a fixed URL, (https://cdn.discordapp.com/emojis/669393875286360084.webp), but the emoji ID is stripped from the JSON output, so there's no way for consuming applications to know. That is, https://github.com/Tyrrrz/DiscordChatExporter/blob/master/DiscordChatExporter.Core/Exporting/Writers/JsonMessageWriter.cs uses PlainTextMarkdownVisitor, instead of preserving
Here's an example of a custom emoji as returned by discord:
"content": "ok, so we know her Lore is dealing with these <:lambda:669393875286360084>-anomalies..."
Which can be resolved by requesting the URL https://cdn.discordapp.com/emojis/669393875286360084.png (or .webp)
But this is JSON outputted by DiscordChatExporter:
"content": "ok, so we know her Lore is dealing with these :lambda:-anomalies...",
As you can see, the JSON exported by DiscordChatExporter is useless for determining which Emoji to request (or whether an emoji is even referenced at all!). Especially since custom emoji may come from potentially-unaccessible private discord servers.
Since users are expected to have some amount of tech savvy to consume the JSON output of message, using PlainTextMarkdownVisitor is inappropriate for JSON output, because it gets rid of a lot of potentially-important metadata in discord's formatting. Instead, JSON output should save the entire un-parsed Discord message, so that downstream consumers can parse it losslessly, and no data is thrown away. Alternatively, if you think it's really important to keep backwards compatibility with this small change, you can add a new key to store this unparsed, lossless data (rawContent?).
I think the end user shouldn't need to assemble the URLs manually and there should be some sort of emoji mapping object that they would be able to access instead.
Closing as out of scope because the project no longer accepts new features