util

package
Version: v0.0.0-...-ef67f48 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Avatars MinecraftRenderType = "avatars"
	Head                        = "head"
	Body                        = "body"
	Skins                       = "skins"
)
View Source
const HEIGHT = 1080
View Source
const TRACE_URL = "https://trace.moe/api/search"
View Source
const WIDTH = 1920

Variables

View Source
var ErrIncorrectCurrency = errors.New("one of the currency symbols is incorrect")
View Source
var SearchQueryTemplate = `` /* 248-byte string literal not displayed */

Functions

func ConvertCurrency

func ConvertCurrency(fromAmt float64, from string, to string) (float64, error)

func ConvertTimezone

func ConvertTimezone(timeStr, srcZoneStr, destZoneStr string) (time.Time, error)

func DecodeFlag

func DecodeFlag(image image.Image) ([]byte, error)

func EncodeFlag

func EncodeFlag(data []byte) image.Image

func GetFontByName

func GetFontByName(name string, size float64) font.Face

func GetMinecraftSkin

func GetMinecraftSkin(player *Player, renderType MinecraftRenderType) (image.Image, error)

func GetNotoBoldFont

func GetNotoBoldFont(size float64) font.Face

func GetNotoFont

func GetNotoFont(size float64) font.Face

func IntnNoDup

func IntnNoDup(n int, prevPick *int) int

func MapToEmoji

func MapToEmoji(in string) (out []string, err error)

func MustMapToEmoji

func MustMapToEmoji(in string) []string

This will panic if it can't do it.

func ParseEmojis

func ParseEmojis(input string) []discordgo.Emoji

func SkipCI

func SkipCI(t *testing.T)

func Translate

func Translate(st, sl, tl string) (string, error)

Types

type ALMedia

type ALMedia struct {
	SiteURL string `json:"siteUrl"`
	Title   struct {
		English string `json:"english"`
	} `json:"title"`
	CoverImage struct {
		Large string `json:"large"`
	} `json:"coverImage"`
	Type         MediaType `json:"type"`
	Status       string    `json:"status"`
	SeasonYear   int       `json:"seasonYear"`
	Episodes     int       `json:"episodes"`
	Duration     int       `json:"duration"`
	Chapters     int       `json:"chapters"`
	Volumes      int       `json:"volumes"`
	Description  string    `json:"description"`
	Genres       []string  `json:"genres"`
	AverageScore int       `json:"averageScore"`
}

func GetAnimeInfoFromID

func GetAnimeInfoFromID(id int) (ALMedia, error)

func GetAnimeInfoFromTitle

func GetAnimeInfoFromTitle(title string) (ALMedia, error)

func GetMangaInfoFromTitle

func GetMangaInfoFromTitle(title string) (ALMedia, error)

type ALRequest

type ALRequest struct {
	Query string `json:"query"`
}

type ALResponse

type ALResponse struct {
	Data struct {
		Media ALMedia `json:"media"`
	} `json:"data"`
}

type Data

type Data struct {
	Player Player `json:"player"`
}

type EmojiConversionError

type EmojiConversionError struct {
	ConversionString string
	FailIdx          int
}

func (EmojiConversionError) Error

func (e EmojiConversionError) Error() string

type ExchangeRateInfo

type ExchangeRateInfo struct {
	Error string `json:"error"`
	Rates map[currency.Unit]float64
	Base  currency.Unit
	Date  string `json:"date"`
}

func GetExchangeRateInfo

func GetExchangeRateInfo(base currency.Unit, symbol currency.Unit) (*ExchangeRateInfo, error)

func (*ExchangeRateInfo) UnmarshalJSON

func (e *ExchangeRateInfo) UnmarshalJSON(data []byte) error

type MediaType

type MediaType string
const (
	Manga MediaType = "MANGA"
	Anime           = "ANIME"
)

type MinecraftRenderType

type MinecraftRenderType string

type NHentai

type NHentai struct {
	Title string

	Tags map[string][]string

	PageCount int
	CoverArt  string

	URL string
}

func ParseNhentai

func ParseNhentai(digits int) (NHentai, error)

type Player

type Player struct {
	Username string                 `json:"username"`
	Id       string                 `json:"id"`
	Avatar   string                 `json:"avatar"`
	Meta     map[string]interface{} `json:"meta"`
}

func LookupMinecraft

func LookupMinecraft(playerName string) (*Player, error)

type Response

type Response struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Success bool   `json:"success"`
	Data    Data   `json:"data"`
}

type TraceMoeDocs

type TraceMoeDocs struct {
	From            float64       `json:"from"`
	To              float64       `json:"to"`
	AnilistID       int           `json:"anilist_id"`
	At              float64       `json:"at"`
	Season          string        `json:"season"`
	Anime           string        `json:"anime"`
	Filename        string        `json:"filename"`
	Episode         int           `json:"episode"`
	Tokenthumb      string        `json:"tokenthumb"`
	Similarity      float64       `json:"similarity"`
	Title           string        `json:"title"`
	TitleNative     string        `json:"title_native"`
	TitleChinese    string        `json:"title_chinese"`
	TitleEnglish    string        `json:"title_english"`
	TitleRomaji     string        `json:"title_romaji"`
	MalID           int           `json:"mal_id"`
	Synonyms        []string      `json:"synonyms"`
	SynonymsChinese []interface{} `json:"synonyms_chinese"`
	IsAdult         bool          `json:"is_adult"`
}

type TraceMoeResp

type TraceMoeResp struct {
	RawDocsCount      int            `json:"RawDocsCount"`
	RawDocsSearchTime int            `json:"RawDocsSearchTime"`
	ReRankSearchTime  int            `json:"ReRankSearchTime"`
	CacheHit          bool           `json:"CacheHit"`
	Trial             int            `json:"trial"`
	Limit             int            `json:"limit"`
	LimitTTL          int            `json:"limit_ttl"`
	Quota             int            `json:"quota"`
	QuotaTTL          int            `json:"quota_ttl"`
	Docs              []TraceMoeDocs `json:"docs"`
}

func TraceAnime

func TraceAnime(i image.Image) (*TraceMoeResp, error)

type TranslateRequest

type TranslateRequest struct {
	SourceText string
	SourceLang string
	TargetLang string
}

type TranslateResponse

type TranslateResponse []interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL