-
-
Notifications
You must be signed in to change notification settings - Fork 477
feat: Added support for emoji aliases like :smile:
in PartialEmoji.from_str (redo)
#2815
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
…moji.fro…" This reverts commit 8619b69.
Also this is not a fix but probably more a feat |
:smile:
in PartialEmoji.from_str (redo):smile:
in PartialEmoji.from_str (redo)
Co-authored-by: Paillat <[email protected]> Signed-off-by: Lala Sabathil <[email protected]>
Signed-off-by: Lala Sabathil <[email protected]>
Signed-off-by: Lala Sabathil <[email protected]>
:smile:
in PartialEmoji.from_str (redo):smile:
in PartialEmoji.from_str (redo)
@Lulalaby pls add |
should i make a new pr or could we add to this pr the support unicode emoji in partial emoji converter ? from discord.partial_emoji import EMOJIS_MAP
class PartialEmojiConverter(Converter[discord.PartialEmoji]):
"""Converts to a :class:`~discord.PartialEmoji`.
This is done by extracting the animated flag, name, and ID for custom emojis,
or by using the standard Unicode emojis supported by Discord.
.. versionchanged:: 1.5
Raise :exc:`.PartialEmojiConversionFailure` instead of generic :exc:`.BadArgument`
"""
async def convert(self, ctx: Context, argument: str) -> discord.PartialEmoji:
match = re.match(r"<(a?):(\w{1,32}):([0-9]{15,20})>$", argument)
if match:
emoji_animated = bool(match.group(1))
emoji_name = match.group(2)
emoji_id = int(match.group(3))
return discord.PartialEmoji.with_state(
ctx.bot._connection,
animated=emoji_animated,
name=emoji_name,
id=emoji_id,
)
if argument in EMOJIS_MAP.values():
return discord.PartialEmoji.with_state(
ctx.bot._connection,
animated=False,
name=argument,
id=None,
)
raise PartialEmojiConversionFailure(argument) for the moment, only custom emoji are supported. |
pr it to the branch |
Signed-off-by: Lala Sabathil <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
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.
tested please someone else test it too
so its rely on this pr (for the emoji custom map, so to be able to pr it i will first need this to be merged. |
oups that's mb, i'm usually not able to pr directly on branch, but it might be different since you are a maintainer |
* Update converter.py * fix: enhance PartialEmojiConverter to support direct emoji names * update doc
Pr changes 😂 I'm too dead |
im gonna sleep its 2am rn, but i'll check that tomorrow morning, if you have a more efficient way to check for the value feel free to share it |
* Add Unicode emoji support to PartialEmojiConverter PartialEmojiConverter now recognizes standard Unicode emojis using a new UNICODE_EMOJIS set loaded from emojis.json. The emoji mapping and set are moved to discord.utils for reuse, and references in partial_emoji.py are updated accordingly. * style(pre-commit): auto fixes from pre-commit.com hooks * Update converter.py Signed-off-by: Lumouille <[email protected]> * Update converter.py * fix(utils): update UNICODE_EMOJIS to use values from EMOJIS_MAP --------- Signed-off-by: Lumouille <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add Unicode emoji support to PartialEmojiConverter PartialEmojiConverter now recognizes standard Unicode emojis using a new UNICODE_EMOJIS set loaded from emojis.json. The emoji mapping and set are moved to discord.utils for reuse, and references in partial_emoji.py are updated accordingly. * style(pre-commit): auto fixes from pre-commit.com hooks * Update converter.py Signed-off-by: Lumouille <[email protected]> * Update converter.py * fix(utils): update UNICODE_EMOJIS to use values from EMOJIS_MAP * fix(partial_emoji): simplify emoji name extraction by using removeprefix and removesuffix * style(pre-commit): auto fixes from pre-commit.com hooks --------- Signed-off-by: Lumouille <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: Lala Sabathil <[email protected]>
Reverts #2814
Re-applies #2774