Open wffirilat opened 4 years ago
Proposed names for the class: UnicodeEmojiUtils
or EmojiUtils
.
About the helper functions, I completely agree. But the proposed names are too big for their own good.
Making them an extension method string#ToDiscordName
string#ToUnicodeChar
and add string#IsUnicodeEmoji
as new helper functions could be the solution.
Usage:
var emoji = ":ok_hand:".ToUnicodeChar(); //Transforms a simple discord name onto a unicode char
if(str.Split(" ").Any(x => x.IsUnicodeEmoji())) //Checks if string has an unicode emoji
It could also be neat to migrate the custom emoji name check that exists on general to EmojiUtils.cs
:
https://github.com/siscodeorg/sisbase/blob/7b2fc4341c763a4a56a56644ed3003a496c4959e/Utils/General.cs#L98-L110
The proposed api would be the string#IsCustomEmoji
extension method.
(see this comment on #31 for motivating discussion)
Current Status:
Utils/Unicode.cs contains a list of unicode code points and discord emoji names, and provides two dictionaries
Emojis
andUnicodeEmojisByDiscordName
that contain the forward and reverse mappings.Proposed Changes:
Utils/Unicode.cs
to something more specific that indicates the relation to unicode emojis. (see issue #31)DiscordEmojiNameFromUnicodeChar
andUnicodeCharFromDiscordEmojiName
?