1
1
Fork 0
mirror of https://gitea.com/gitea/tea synced 2024-05-21 15:16:07 +02:00
tea/vendor/github.com/enescakir/emoji
Norwin 58aaa17e7e Show issue reactions (#421)
```
$ tea issue 230

   #230 issue/pull details: show reactions (open)

  @6543 created 2020-10-22 16:39

  since reactions are utf8 now and most terminals too, we can display them nicely :)

  https://gitea.com/api/v1/repos/gitea/tea/issues/230/reactions

  --------

  1x πŸŽ‰  |  1x πŸ‘€  |  1x :gitea:  |  1x πŸ‘  |  1x πŸ‘Ž  |  1x πŸ˜†  |  1x πŸ˜•  |  1x ❀️
```

caveats:
- reactions are not returned as UTF8 (as was claimed in #230), so they need to be parsed. the library I use doesn't (and can't β†’ :gitea:) support all reactions available in gitea
- currently only for issues, as reactions for comments mean an additional API request for each comment..

fixes #230

Co-authored-by: Norwin <git@nroo.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/421
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Norwin <noerw@noreply.gitea.io>
Co-committed-by: Norwin <noerw@noreply.gitea.io>
2021-10-01 16:13:32 +08:00
..
.gitignore Show issue reactions (#421) 2021-10-01 16:13:32 +08:00
LICENSE Show issue reactions (#421) 2021-10-01 16:13:32 +08:00
README.md Show issue reactions (#421) 2021-10-01 16:13:32 +08:00
constants.go Show issue reactions (#421) 2021-10-01 16:13:32 +08:00
doc.go Show issue reactions (#421) 2021-10-01 16:13:32 +08:00
emoji.go Show issue reactions (#421) 2021-10-01 16:13:32 +08:00
fmt.go Show issue reactions (#421) 2021-10-01 16:13:32 +08:00
go.mod Show issue reactions (#421) 2021-10-01 16:13:32 +08:00
go.sum Show issue reactions (#421) 2021-10-01 16:13:32 +08:00
map.go Show issue reactions (#421) 2021-10-01 16:13:32 +08:00
parser.go Show issue reactions (#421) 2021-10-01 16:13:32 +08:00

emoji πŸš€ πŸŽ’ πŸŽ‰

Build Status godoc Go Report Card Codecov MIT License

emoji is a minimalistic emoji library for Go. It lets you use emoji characters in strings.

Inspired by spatie/emoji

Install πŸ’Ύ

go get github.com/enescakir/emoji

Usage πŸ„

package main

import (
    "fmt"

    "github.com/enescakir/emoji"
)

func main() {
	fmt.Printf("Hello %v\n", emoji.WavingHand)
	fmt.Printf("I am %v from %v\n",
		emoji.ManTechnologist,
		emoji.FlagForTurkey,
	)
	fmt.Printf("Different skin tones.\n  default: %v light: %v dark: %v\n",
		emoji.ThumbsUp,
		emoji.OkHand.Tone(emoji.Light),
		emoji.CallMeHand.Tone(emoji.Dark),
	)
	fmt.Printf("Emojis with multiple skin tones.\n  both medium: %v light and dark: %v\n",
		emoji.PeopleHoldingHands.Tone(emoji.Medium),
		emoji.PeopleHoldingHands.Tone(emoji.Light, emoji.Dark),
	)
	fmt.Println(emoji.Parse("Emoji aliases are :sunglasses:"))
	emoji.Println("Use fmt wrappers :+1: with emoji support :tada:")
}

/* OUTPUT

    Hello πŸ‘‹
    I am πŸ‘¨β€πŸ’» from πŸ‡ΉπŸ‡·
    Different skin tones.
      default: πŸ‘ light: πŸ‘ŒπŸ» dark: πŸ€™πŸΏ
    Emojis with multiple skin tones.
      both medium: πŸ§‘πŸ½β€πŸ€β€πŸ§‘πŸ½ light and dark: πŸ§‘πŸ»β€πŸ€β€πŸ§‘πŸΏ
    Emoji aliases are 😎
    Use fmt wrappers πŸ‘ with emoji support πŸŽ‰
*/

This package contains emojis constants based on Full Emoji List v13.0.

emoji.CallMeHand // πŸ€™
emoji.CallMeHand.Tone(emoji.Dark) // πŸ€™πŸΏ

Also, it has additional emoji aliases from github/gemoji.

emoji.Parse(":+1:") // πŸ‘
emoji.Parse(":100:") // πŸ’―

You can generate country flag emoji with ISO 3166 Alpha2 codes:

emoji.CountryFlag("tr") // πŸ‡ΉπŸ‡·
emoji.CountryFlag("US") // πŸ‡ΊπŸ‡Έ
emoji.Parse("country flag alias :flag-gb:") // country flag alias πŸ‡¬πŸ‡§

All constants are generated by internal/generator.

Testing πŸ”¨

go test

Todo πŸ“Œ

  • Add examples to godoc

Contributing πŸ‘¨β€πŸ’»

I am accepting PRs that add aliases to the package. You have to add it to customEmojis list at internal/generator/main.

If you think an emoji constant is not correct, open an issue. Please use this list to look up the correct unicode value and the name of the character.

Credits ⭐

License πŸ“œ

The MIT License (MIT). Please see License File for more information.