util

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 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://api.trace.moe/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 TraceMoeResp

type TraceMoeResp struct {
	FrameCount int              `json:"frameCount"`
	Error      string           `json:"error"`
	Result     []TraceMoeResult `json:"result"`
}

func TraceAnime

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

type TraceMoeResult added in v1.1.0

type TraceMoeResult struct {
	Anilist    int     `json:"anilist"`
	Filename   string  `json:"filename"`
	Episode    int     `json:"episode"`
	From       float64 `json:"from"`
	To         float64 `json:"to"`
	Similarity float64 `json:"similarity"`
	Video      string  `json:"video"`
	Image      string  `json:"image"`
}

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
y or Y : Canonical URL