Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show names of standard emoji when hovering over them #599

Closed
CanePlayz opened this issue May 29, 2021 · 24 comments
Closed

Show names of standard emoji when hovering over them #599

CanePlayz opened this issue May 29, 2021 · 24 comments

Comments

@CanePlayz
Copy link
Contributor

Flavor

No response

Export format

HTML

Details

I don't exactly know how to call them, but when you hover over certain "standard emoji", that are integrated in Windows, the emoji name isn't shown but instead it's the actual emote in a different style:
image

When you hover over a custom emote, the name of it is shown:
image

I don't know what other people think about this, but to keep it consistent I think when you hover standard emoji it should also show their name. And in general, I think that way it's just way better.

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 30, 2021

I welcome suggestions on how to identify emojis by name ;)

@CanePlayz
Copy link
Contributor Author

CanePlayz commented May 30, 2021

Oh, that's unfortunately not where I can help you, naive me thought that if you can get the name of custom emoji from the API and put it in there, you could do it for standard emoji as well.

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 31, 2021

Unfortunately standard emojis are not identified in any way, they are just contained within the text body as characters.

@CanePlayz
Copy link
Contributor Author

Ok I see, but from as much as I understand, while some actually aren't, those for which the emoji matcher works, are contained as emoji in the HTML file. For example, 😄 is a standard emoji but is actually contained as an emoji in the HTML file and not just as a character:
image
Wouldn't it be possible then to at least do it for those, since they are contained as emoji in the file? Or do I understand that wrong, and them being contained as emoji still doesn't make it possible to show their actual name?

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 31, 2021

Well what I mean by that is that 😄 is a character (or a rune to be precise). It's identified by its codepoint(s), which is U+1F604 in this case.

To resolve the emoji "name", we'd need some sort of table that maps those codepoints to something like "smile". It may also be useful for other issues like #549.

For contrast, custom emojis in Discord are instead formatted like this: :myemoji:12345 where it has both the name and the ID (unrelated to codepoints, this is just an internal Discord ID which we can use to get the emoji image).

@CanePlayz
Copy link
Contributor Author

Okay, I understand.

To resolve the emoji "name", we'd need some sort of table that maps those codepoints to something like "smile". It may also be useful for other issues like #549.

Would it be possible for me even without much background knowledge (I understand most of it, I'm just not into coding) to help out with that table with instructions from you and it's just simple work but takes a lot of time (I would be down to do that) or does creating a table like that actually require some more deep knowledge I would need?

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 31, 2021

Would it be possible for me even without much background knowledge (I understand most of it, I'm just not into coding) to help out with that table with instructions from you and it's just simple work but takes a lot of time (I would be down to do that) or does creating a table like that actually require some more deep knowledge I would need?

Yeah it's mostly just manual work. The goal is to find all emoji names that Discord has and put them into a table like this:

Name|Emoji
:pensive:|😔
:joy:|😂

Some emojis may have multiple names too I think. I'm not sure what's the most efficient way to approach this other than to meticulously go through each emoji in the emoji picker (maybe there's a list somewhere?).

@CanePlayz
Copy link
Contributor Author

I haven't found a list somewhere, but I'll start creating one as soon as I have time. Just one more quick question: If there are multiple names for one and the same emoji (for example :thinking: and :thinking_face:), how do I put them into the table?

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 31, 2021

Thanks!
You can put them next to each other, i.e.

:thinking:|🤔
:thinking_face:|🤔

@CanePlayz
Copy link
Contributor Author

Ok.

So the closest thing to a list I could find was this json file from the Android app: https://drive.google.com/file/d/13ytMWyBq_ZpGsub_GCoLP1qEBAY8tfKn/view?usp=sharing
While I don't think it's really useful for that, I thought it's worth a try. And even if it doesn't help in the first place, I can use that file to copy the names and emojis faster to my own list.

@96-LB
Copy link
Sponsor Contributor

96-LB commented May 31, 2021

Is this straight from Discord itself? That actually looks really useful.

@CanePlayz
Copy link
Contributor Author

Yes, it's from one of the latest android apks

@96-LB
Copy link
Sponsor Contributor

96-LB commented May 31, 2021

I think we could reasonably extract a mapping between names and codepoints from that file. That would probably help #548 as well since this lists every emoji which Discord renders, allowing us to cross-reference it before rendering it in Twemoji. It looks as if it includes the zero-width joiner sequences such as the family emoji and different skin tones, so maybe we can get support for those too.

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 31, 2021

Yeah looks useful

@CanePlayz
Copy link
Contributor Author

Does that mean you don't need me to manually put together that list?

@96-LB
Copy link
Sponsor Contributor

96-LB commented Jun 1, 2021

Probably not. It'd be much easier to either write a quick progam that converts the JSON file into our :thinking:|🤔 format, or just use the JSON file itself. If needed/wanted, I can convert it to that table format and upload it here.

@Tyrrrz
Copy link
Owner

Tyrrrz commented Jun 1, 2021

The table format itself doesn't matter, we just need the mapping, which the JSON file seems to provide (assuming it's complete).

@96-LB
Copy link
Sponsor Contributor

96-LB commented Jun 1, 2021

It seems to be complete. One thing to watch out for is that some emoji are nested inside others as "diversity children". For example, the JSON object for 👍 has child properties for 👍🏻, 👍🏽, 👍🏿, etc. instead of the latter being listed at the top of the hierarchy.

@Tyrrrz
Copy link
Owner

Tyrrrz commented Jun 1, 2021

It seems to be complete. One thing to watch out for is that some emoji are nested inside others as "diversity children". For example, the JSON object for 👍 has child properties for 👍🏻, 👍🏽, 👍🏿, etc. instead of the latter being listed at the top of the hierarchy.

They still have all the required information it seems, so it's fine. I think ideally we'd want to convert it to a planar representation (similar to the table format I mentioned). We could probably just extract the data from JSON file and convert it to static C# code (dictionary of name<->codepoints mapping) so we don't have to deal with it at runtime.

@96-LB
Copy link
Sponsor Contributor

96-LB commented Jun 2, 2021

We could probably just extract the data from JSON file and convert it to static C# code (dictionary of name<->codepoints mapping) so we don't have to deal with it at runtime.

Something like a file containing the following?

static Dictionary<string, string> emojiMap = new()
{
    ["grinning"] = "😀",
    ["laughing"] = "😆",
    ["satisfied"] = "😆",
    //...
};

(and vice versa)

@Tyrrrz
Copy link
Owner

Tyrrrz commented Jun 2, 2021

Yes.

@CanePlayz
Copy link
Contributor Author

With the release of Twemoji 13.1 just two days ago in Discord, there have been new emotes added. Here is the new json file including the new ones as well: https://drive.google.com/file/d/1lZ3IcSAEnUOHODQhkOieiwJ1cx68G0XO/view?usp=sharing

@96-LB
Copy link
Sponsor Contributor

96-LB commented Jun 17, 2021

I've got a lot going on right now, but I've extracted the emoji lists into Dictionaries and attached them to this message in case anyone wants to use them for a PR.
surrogatesToNames.txt
namesToSurrogates.txt

@Tyrrrz
Copy link
Owner

Tyrrrz commented Jun 17, 2021

Thanks @96-LB!
This should make the issue quite straightforward for anyone who wants to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants