Emojis for Go πŸ˜„πŸ’πŸš€

Overview

turtle

Emojis for Go πŸ˜„ 🐒 πŸš€

Reference

Follow this link to view the reference documentation: GoDoc Reference πŸ“

Installation

Library

To install the turtle library run:

go get github.com/hackebrot/turtle

CLI app

If you would also like to use the turtle CLI app run:

go get github.com/hackebrot/turtle/cmd/turtle

See the turtle CLI README for more information.

Usage

Emoji lookup

turtle.Emojis is a map which contains all emojis available in turtle. You can use it to look up emoji by their name.

package main

import (
	"fmt"
	"os"

	"github.com/hackebrot/turtle"
)

func main() {
	name := "turtle"
	emoji, ok := turtle.Emojis[name]

	if !ok {
		fmt.Fprintf(os.Stderr, "no emoji found for name: %v\n", name)
		os.Exit(1)
	}

	fmt.Printf("Name: %q\n", emoji.Name)
	fmt.Printf("Char: %s\n", emoji.Char)
	fmt.Printf("Category: %q\n", emoji.Category)
	fmt.Printf("Keywords: %q\n", emoji.Keywords)
}
Name: "turtle"
Char: 🐒
Category: "animals_and_nature"
Keywords: ["animal" "slow" "nature" "tortoise"]

Search

Use Search() to find all emojis with a name that contains the search string.

package main

import (
	"fmt"
	"os"

	"github.com/hackebrot/turtle"
)

func main() {
	s := "computer"
	emojis := turtle.Search(s)

	if emojis == nil {
		fmt.Fprintf(os.Stderr, "no emojis found for search: %v\n", s)
		os.Exit(1)
	}

	fmt.Printf("%s: %s\n", s, emojis)
}
computer: [πŸ’» πŸ–± πŸ–₯ ]

Category

Use Category() to find all emojis of the specified category.

package main

import (
	"fmt"
	"os"

	"github.com/hackebrot/turtle"
)

func main() {
	c := "travel_and_places"
	emojis := turtle.Category(c)

	if emojis == nil {
		fmt.Fprintf(os.Stderr, "no emojis found for category: %v\n", c)
		os.Exit(1)
	}

	fmt.Printf("%s: %s\n", c, emojis)
}
travel_and_places: [🚑 ✈️ πŸš‘ ]

Keyword

Use Keyword() to find all emojis by a keyword.

package main

import (
	"fmt"
	"os"

	"github.com/hackebrot/turtle"
)

func main() {
	k := "happy"
	emojis := turtle.Keyword(k)

	if emojis == nil {
		fmt.Fprintf(os.Stderr, "no emoji found for keyword: %v\n", k)
		os.Exit(1)
	}

	fmt.Printf("%s: %s\n", k, emojis)
}
happy: [😊 😁 πŸ˜€ πŸ˜‚ ]

Emojis

Emoji names, categories and keywords are based on the fantastic muan/emojilib keyword library πŸ“–

At this point, the turtle project supports the emojis that are also available on GitHub. See the GitHub REST API documentation for more information.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

License

Distributed under the terms of the MIT license, turtle is free and open source software.

You might also like...
Comments
  • Release?

    Release?

    Due to the fact that there was a single tag created in 2017, unless a user goes out of their way to update (via go get github.com/hackebrot/[email protected], for example) they will only ever use that version from back then. Could we start creating releases more often? A silly option would be to create a github action that creates a new tag for each push (something like v0.1.YYYYMMDDH or something)

    project 
    opened by frioux 1
  • Add lookup by emoji character πŸ•΅οΈβ€β™‚οΈ

    Add lookup by emoji character πŸ•΅οΈβ€β™‚οΈ

    This introduces a new map to the library EmojisByChar and a new command char to look up an emoji by its character.

    Thanks so much @Scuilion for #9 as it helped me realize that it makes more sense for the library to feature an additional map from emoji character to emoji rather than a new function which outputs a single struct field. I think this revised design is more consistent and intuitive. I'm sorry that it's taken me so long to review your changes. I cherry-picked and reverted your commit to make sure your contribution is reflected in the GitHub contributors view. 🐒

    Resolve #8

    enhancement 
    opened by hackebrot 0
  • Improve handling of positional arguments

    Improve handling of positional arguments

    Add argument names to Use and considering using OnlyValidArgs for the root command to only allow specifying existing emoji names as well as ExactArgs for sub commands.

    See https://github.com/spf13/cobra/issues/395

    enhancement 
    opened by hackebrot 0
  • Add skin tone support property

    Add skin tone support property

    Some emojis can be combined with skin tones. For example, point up: ☝ ☝🏿 ☝🏾 ☝🏽 ☝🏼 ☝🏻

    Not all emojis support them though. It would be very helpful if turtle had a boolean property indicating whether the emoji supports skin tones.

    See this for more information: https://emojipedia.org/emoji-modifier-sequence/

    opened by devnoname120 0
Owner
Raphael Pierzina
open-source developer πŸ‘¨πŸ»β€πŸ’» member of @pytest-dev πŸš€ staff test engineer at @mozilla πŸ”₯🦊 he/him
Raphael Pierzina
An experiment in rendering images with Slack custom emojis.

emojimage An experiment in rendering images with Slack custom emojis. Example Usage 1. Initializing your workspace First, you'll need to upload 1,332

Caleb Denio 9 Mar 12, 2022
A discord server guard which uses emojis and bot detection (WIP)

server-guard A discord server guard which uses emojis and bot detection (WIP) Config options SusLevel: how many checks the account has to fail before

post 10 Dec 6, 2021
Extract sent emojis from your Discord messages, and download them

discord-emoji-extractor Download all the emojis you've ever sent inside messages on Discord. Supports skipping duplicates and resuming downloads. Usag

liv 4 Jan 1, 2022
A Pac Man clone written in Go (with emojis!)

A Pac Man clone written in Go (with emojis!)

Daniela Petruzalek 1.1k Sep 24, 2022
A simple programming language with emojis only

MOGEE mogee (pronounced Δ“ΛˆmōjΔ“) is an extremely simple interpreted programming language that consists solely of emojis. Similar to Brainfuck, mogee is

Barış İnandıoğlu 1 Nov 15, 2021
Slack-emoji-bot - This Slack bot will post the newly created custom Slack emojis to the channel of your choice

Slack Emoji Bot This Slack bot will post the newly created custom Slack emojis t

Ryan Hollis 7 Sep 23, 2022