emote

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmoteCacheDir added in v0.4.0

func EmoteCacheDir() (string, error)

func ReplaceEmoteColored added in v0.4.0

func ReplaceEmoteColored(emote Emote) string

func SaveCache added in v0.4.0

func SaveCache(e Emote, dec DecodedEmote) error

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 DecodedEmote added in v0.4.0

type DecodedEmote struct {
	ID     int            `json:"-"`
	Cols   int            `json:"cols"`
	Images []DecodedImage `json:"images"`
}

func (DecodedEmote) DisplayUnicodePlaceholder added in v0.4.0

func (d DecodedEmote) DisplayUnicodePlaceholder() string

func (DecodedEmote) PrepareCommand added in v0.4.0

func (d DecodedEmote) PrepareCommand() string

type DecodedImage added in v0.4.0

type DecodedImage struct {
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	EncodedPath string `json:"encoded_path"`
	DelayInMS   int    `json:"delay_in_ms"`
}

type Emote

type Emote struct {
	ID         string
	Text       string
	Platform   Platform
	URL        string
	IsAnimated bool
	Format     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)
}

type Platform

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

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, cellWidth, cellHeight float32) *Replacer

func (*Replacer) ConvertEmote added in v0.4.0

func (i *Replacer) ConvertEmote(e Emote, r io.Reader) (DecodedEmote, error)

func (*Replacer) Replace added in v0.4.0

func (i *Replacer) Replace(content string) (string, string, error)

type SevenTVEmoteFetcher

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

type Store

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

func NewStore

func NewStore(logger zerolog.Logger, twitchEmotes TwitchEmoteFetcher, sevenTVEmotes SevenTVEmoteFetcher, bttvEmotes BTTVEmoteFetcher) *Store

func (*Store) GetAll added in v0.4.0

func (s *Store) GetAll() EmoteSet

func (*Store) GetAllForUser

func (s *Store) GetAllForUser(id string) EmoteSet

func (*Store) GetByText

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

func (*Store) GetByTextAllChannels added in v0.4.0

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

func (*Store) RefreshGlobal

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

func (*Store) RefreshLocal

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

type TwitchEmoteFetcher

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

Jump to

Keyboard shortcuts

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