-
-
Notifications
You must be signed in to change notification settings - Fork 474
fix: support emoji aliases like :smile:
in PartialEmoji.from_str
#2774
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Lumouille <[email protected]>
fix of #1582 |
so my current fix is using the emoji lib : https://pypi.org/project/emoji/ |
Signed-off-by: Lumouille <[email protected]>
:smile:
in PartialEmoji.from_str
I have been using this for years and I never really had any issue of missing emoji, but I'll try to do a test with every emoji of discord to see if there is lacking one. |
Im thinking else I can do a json file with every discord emoji so I can just replace it |
@Lumabots dmed you on discord a huge json from discord with all the emojis. Maybe it can be helpful to you in some way ? Specifically the |
I'm not sure this is really ideal; users are expected to pass actual unicode emojis, not |
Lala added a bug tag in the related issue so I assumed it was |
Signed-off-by: Lumouille <[email protected]>
Signed-off-by: Lumouille <[email protected]>
should be ready for review using Paillait Lib dismoji |
I'm strongly against adding a new dependency for this. |
To be honest I agree that adding a dependency is not a good idea. To be clear, while this issue made me create that lib, I did not create it with the intent of it specifically be used in py-cord. Maybe a note should simply be added indicating to use a custom converter with a link to this pr &/ the issue. An alternative could be to modify |
Why not just use ur system so we do a requests at first to get the emoji list from discord, and then just replace it directly ? So no need to install a new one |
Signed-off-by: Lumouille <[email protected]>
Signed-off-by: Lumouille <[email protected]>
Signed-off-by: Lumouille <[email protected]>
so i implemented a way to just download paillait file and then replace the emoji, i just need to find a way to load this file wihout blocking the bot. if you want to proceed differently tell me |
@Lumabots cor security reasons it is not possible to have it download at startup. Instead, you would need to download the file and store it next to the python code and load from there, and the file should be updated periodically. To open the file you can use pathlib like this: import json
from pathlib import Path
EMOJIS_MAP_PATH = Path(__file__).parent / "emojis.json"
with EMOJIS_MAP_PATH.open("r", encoding="utf-8") as f:
EMOJIS_MAP = json.loads(f.read()) |
Signed-off-by: Lumouille <[email protected]>
Signed-off-by: Lumouille <[email protected]>
Signed-off-by: Lumouille <[email protected]>
should be ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as including the json in the build is approved, this lgtm. However I have no idea wether there are some rules that would exclude it at build time so that should be verified.
Co-authored-by: plun1331 <[email protected]> Signed-off-by: Lumouille <[email protected]>
Signed-off-by: Lumouille <[email protected]>
Co-authored-by: Paillat <[email protected]> Signed-off-by: Lumouille <[email protected]>
Signed-off-by: Lumouille <[email protected]>
Summary
Information
Fixes
discord.Emoji
anddiscord.PartialEmoji
didn't work in slash option. #1582examples, ...).
Checklist
type: ignore
comments were used, a comment is also left explaining why.