discordemojimap

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2019 License: BSD-3-Clause Imports: 2 Imported by: 7

README

Discord Emoji Map

builds.sr.ht status GoDoc codecov

This is the map of emojis that discord uses. However, I have left out different skin tones and such. A complete map might follow at some point.

Usage

The usage is quite simple, you just pass your input string and it replaces all valid emoji sequences with their respective emojis.

package main

import (
    "fmt"
    "github.com/Bios-Marcel/discordemojimap"
)

func main() {
    fmt.Println(discordemojimap.Replace("What a wonderful day :sun_with_face:, am I right?"))
}

Documentation

Overview

Package discordemojimap provides a Replace function in order to escape emoji sequences with their respective emojis.

Index

Constants

This section is empty.

Variables

View Source
var EmojiMap = map[string]string{}/* 1558 elements not displayed */

EmojiMap is the full list of emoji codes to their respective unicode symbols. This is map is public in order to allow memory efficient usage. Be careful and do not adjust this map!

Functions

func ContainsCode

func ContainsCode(emojiCode string) bool

ContainsCode returns true if that emojicode is mapped to an emoji.

func ContainsEmoji

func ContainsEmoji(emoji string) bool

ContainsEmoji returns true if that emoji is mapped to one or more key.

func GetEmoji

func GetEmoji(emojiCode string) string

GetEmoji returns the matching emoji or an empty string in case no match was found for the given code.

func GetEmojiCodes

func GetEmojiCodes(emoji string) []string

GetEmojiCodes contains all codes for an emoji in an array. If no code could be found, then the resulting array will be empty.

func GetEntriesStartingWith

func GetEntriesStartingWith(startsWith string) map[string]string

GetEntriesStartingWith returns all key-value pairs where the key(code) is prefixed with the given string. If no matches were found, the map is empty.

func Replace

func Replace(input string) string

Replace all emoji sequences contained in the discord emoji map with their respective emojis.

Examples for valid input:

Replace("Hello World :sun_with_face:")

would result in

"Hello World 🌞"

Types

This section is empty.

Directories

Path Synopsis
tools

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL