emote

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 22 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPartialFetch = errors.New("emote data could only be partially fetched")

Functions

This section is empty.

Types

type BTTVEmoteFetcher added in v0.0.3

type BTTVEmoteFetcher interface {
	GetGlobalEmotes(context.Context) (bttv.GlobalEmoteResponse, error)
	GetChannelEmotes(ctx context.Context, broadcaster string) (bttv.UserResponse, error)
}

type Cache added in v0.6.2

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache added in v0.6.2

func NewCache(logger zerolog.Logger, twitchEmotes TwitchEmoteFetcher, sevenTVEmotes SevenTVEmoteFetcher, bttvEmotes BTTVEmoteFetcher, ffzEmotes FFZEmoteFetcher) *Cache

func (*Cache) AddUserEmotes added in v0.6.2

func (s *Cache) AddUserEmotes(userID string, emotes []Emote)

func (*Cache) AllEmotesUsableByUser added in v0.6.2

func (s *Cache) AllEmotesUsableByUser(userID string) []Emote

func (*Cache) GetAll added in v0.6.2

func (s *Cache) GetAll() EmoteSet

func (*Cache) GetAllForChannel added in v0.6.2

func (s *Cache) GetAllForChannel(id string) EmoteSet

GetAllForChannel retrieves all emotes for a specific user.

func (*Cache) GetByText added in v0.6.2

func (s *Cache) GetByText(channelID, text string) (Emote, bool)

func (*Cache) GetByTextAllChannels added in v0.6.2

func (s *Cache) GetByTextAllChannels(text string) (Emote, bool)

func (*Cache) LoadSetForeignEmote added in v0.6.2

func (s *Cache) LoadSetForeignEmote(emoteID, emoteText string) Emote

func (*Cache) RefreshGlobal added in v0.6.2

func (s *Cache) RefreshGlobal(ctx context.Context) error

func (*Cache) RefreshLocal added in v0.6.2

func (s *Cache) RefreshLocal(ctx context.Context, channelID string) error

RefreshLocal refreshes the local emote cache for a specific channel. A failing or slow 3rd party API costs only its own emotes: the rest is cached and an ErrPartialFetch is returned. Nothing is cached when the refresh as a whole ran out of time before any provider answered.

func (*Cache) RemoveEmoteSetForChannel added in v0.6.2

func (s *Cache) RemoveEmoteSetForChannel(channelID string)

type DisplayManager added in v0.6.2

type DisplayManager interface {
	Convert(unit kittyimg.DisplayUnit) (kittyimg.KittyDisplayUnit, error)
}

type Emote

type Emote struct {
	ID         string
	Text       string
	Platform   Platform
	URL        string
	IsAnimated bool
	Format     string

	// For channel specific twitch emotes
	// bitstier, follower, subscriptions
	TTVEmoteType string
}

type EmoteSet

type EmoteSet []Emote

func (EmoteSet) GetByText

func (set EmoteSet) GetByText(text string) (Emote, bool)

type EmoteStore added in v0.4.0

type EmoteStore interface {
	GetByTextAllChannels(text string) (Emote, bool)
	GetByText(channelID, text string) (Emote, bool)
	LoadSetForeignEmote(emoteID, emoteText string) Emote
}

type FFZEmoteFetcher added in v0.9.0

type FFZEmoteFetcher interface {
	GetGlobalEmotes(context.Context) ([]ffz.Emote, error)
	GetChannelEmotes(ctx context.Context, broadcaster string) ([]ffz.Emote, error)
}

type Platform

type Platform int
const (
	Unknown Platform = iota
	Twitch
	SevenTV
	BTTV
	FFZ
)

func (Platform) String

func (p Platform) String() string

type Replacer added in v0.4.0

type Replacer struct {
	// contains filtered or unexported fields
}

func NewReplacer added in v0.4.0

func NewReplacer(httpClient *http.Client, store EmoteStore, enableGraphics bool, theme save.Theme, displayManager DisplayManager) *Replacer

func (*Replacer) Replace added in v0.4.0

func (i *Replacer) Replace(ctx context.Context, channelID, content string, emoteList []twitchirc.Emote) (string, map[string]string, error)

Replace enriches emote tokens, using ctx for every image download. Cancellation returns any replacements already prepared along with the context error.

type SevenTVEmoteFetcher

type SevenTVEmoteFetcher interface {
	GetGlobalEmotes(context.Context) (seventv.EmoteResponse, error)
	GetChannelEmotes(ctx context.Context, broadcaster string) (seventv.ChannelEmoteResponse, error)
}

type TwitchEmoteFetcher

type TwitchEmoteFetcher interface {
	GetGlobalEmotes(context.Context) (twitchapi.EmoteResponse, error)
	GetChannelEmotes(ctx context.Context, broadcaster string) (twitchapi.EmoteResponse, error)
}

Jump to

Keyboard shortcuts

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