cache

package
v0.0.0-...-3b3c969 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SIXELNoDithering

func SIXELNoDithering(enc sixel.Encoder)

Types

type Avatar

type Avatar struct {
	*ImageStore
}

func NewAvatarStore

func NewAvatarStore() *Avatar

func (*Avatar) DownloadAvatar

func (i *Avatar) DownloadAvatar(u *discordgo.User) ([]byte, error)

type Image

type Image struct {
	Original image.Image
	SIXEL    []byte
}

type ImageOption

type ImageOption func(img image.Image) image.Image

type ImageStore

type ImageStore struct {
	EncodeOptions []func(enc *sixel.Encoder)
	ImageOptions  []ImageOption
	// contains filtered or unexported fields
}

func NewImageStore

func NewImageStore() *ImageStore

func (*ImageStore) AddImageOptions

func (i *ImageStore) AddImageOptions(f ...ImageOption)

func (*ImageStore) Download

func (i *ImageStore) Download(url string, imageOpts ...ImageOption) (*Image, error)

type User

type User struct {
	ID      string
	Discrim string
	Name    string
	Nick    string
	Color   int64
}

User is used for one user

type UserStoreArray

type UserStoreArray []User

UserStoreArray is an array

type Users

type Users struct {
	sync.RWMutex
	Guilds map[string]UserStoreArray
	// contains filtered or unexported fields
}

Users stores multiple users

func NewUserCache

func NewUserCache(dg *discordgo.Session) *Users

func (*Users) DiscordThis

func (s *Users) DiscordThis(m *discordgo.Message) (n string, c int64)

DiscordThis interfaces with DiscordGo

func (*Users) GetUser

func (s *Users) GetUser(guildID, id string) (int, *User)

GetUser returns the index and user for that ID

func (*Users) InStore

func (s *Users) InStore(guildID, id string) bool

InStore checks if a user is in the store

func (*Users) Populated

func (s *Users) Populated(guildID string) bool

Populated returns a bool on whether or not the array alraedy is populated

func (*Users) RemoveUser

func (s *Users) RemoveUser(guildID, id string)

RemoveUser removes the user from the store

func (*Users) UpdateUser

func (s *Users) UpdateUser(guildID, id, name, nick, discrim string, color int64)

UpdateUser updates an user

Jump to

Keyboard shortcuts

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