Documentation ¶
Overview ¶
Package discordemojimap provides a Replace function in order to escape emoji sequences with their respective emojis.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var EmojiMap = map[string]string{}/* 5467 elements not displayed */
Functions ¶
func ContainsCode ¶
ContainsCode returns true if emojiCode is mapped to an emoji. The search is case-insensitive.
Example ¶
fmt.Println(ContainsCode("grimacing"))
Output: true
func ContainsEmoji ¶
ContainsEmoji returns true if that emoji is mapped to one or more key.
Example ¶
fmt.Println(ContainsEmoji("😀"))
Output: true
func GetEmoji ¶
GetEmoji returns the matching emoji or an empty string in case no match was found for the given code.
The function will search without accounting for colons. The search is case-insensitive.
Example ¶
fmt.Println(GetEmoji("lion"))
Output: 🦁
func GetEmojiCodes ¶
GetEmojiCodes contains all codes for an emoji in an array. If no code could be found, then the resulting array will be empty.
Example ¶
codes := GetEmojiCodes("🦁") sort.Strings(codes) fmt.Println(codes)
Output: [lion lion_face]
func GetEntriesWithPrefix ¶
GetEntriesWithPrefix returns a map of all found emojis with the given prefix.
The function will search without accounting for leading colons. The search is case-insensitive.
Example ¶
fmt.Printf("%+v\n", GetEntriesWithPrefix("lio"))
Output: map[lion:🦁 lion_face:🦁]
func Replace ¶
Replace all emoji sequences contained in the emoji map with their respective emojis. For example:
fmt.Println(Replace("Hello World :sun_with_face:")) //Output: Hello World 🌞
This function is optimized for lowercased emoji sequence, meaning that sequences such as ":SUNGLASSES:" will consume slightly more memory and be slightly slower. However, the impact should be insignificant in most cases.
Types ¶
This section is empty.