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

Add alias for smiling face with heart eyes #268

Merged
merged 1 commit into from
Jul 14, 2023

Conversation

snus-kin
Copy link

This alias is used in the YouTube frontend and the linked emoji site in the repo

@cvzi
Copy link
Contributor

cvzi commented Jun 29, 2023

It looks like the cheat sheet website has been updated.

There seem to be a few more changes/additions, but there are also some obvious errors for example,
if you type in the search "shaking", the result is

🤥

with the strange shortcode :⊛_shaking_face:

@snus-kin
Copy link
Author

Ah yes, very easy to type that circled asterix operator!

I suppose some of these are slightly absurd but I created this PR since I found that one in use in the wild and wanted to use this library on it :)

@cvzi
Copy link
Contributor

cvzi commented Jun 30, 2023

I was just wondering whether/how we should add all of the new ones. We have a script to update the emoji, but I removed the "emoji cheet sheet" as a source, because the website wasn't updated in a long time.

Since you mentioned Youtube, I found this document is used on youtube.com and seems to contain all youtube emojis:
https://www.gstatic.com/youtube/img/emojis/emojis-png-7.json
That might be a more reliable source than using the "emoji cheet sheet"

@snus-kin
Copy link
Author

snus-kin commented Jul 3, 2023

It would be cool if there was a way to make these things user-extensible, I guess. Not sure what is extant for that sort of thing as of right now. Even just providing an extra little dict of {":shortcut:": "<emoji>"} in a setup call might be nice

@cvzi
Copy link
Contributor

cvzi commented Jul 4, 2023

I think that's a good idea. It's actually possible at the moment, but not documented or specified. A dedicated setup function would be nice.

At the moment you can change the EMOJI_DATA dict, as long as you do it before the first call of emojize() .

For example adding that one alias:

import emoji

emoji.EMOJI_DATA['😍']['alias'].insert(0, ':smiling_face_with_heart_eyes:')

print(emoji.emojize("test :smiling_face_with_heart_eyes:", language="alias"))
print(emoji.demojize("test 😍", language="alias"))

Note: demojize() only uses the first entry of the alias-list, so there is a difference between using .insert(0, ':shortcode:') and .append(':shortcode:').

@cvzi
Copy link
Contributor

cvzi commented Jul 6, 2023

I'll add the cheat sheet back into the script to automatically update from the cheat sheet. There are only few "strange" ones with the asterix operator, I can filter them by hand.

So @TahirJalilov you can merge this pull request, and then I will create another pull request with the rest of the missing short-codes from the cheat sheet.

@TahirJalilov TahirJalilov merged commit 4f4aa0a into carpedm20:master Jul 14, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants