state

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dgrs

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

Dgrs is the State implementation for zekrotja/dgrs.

func NewDgrs

func NewDgrs(st *dgrs.State) *Dgrs

NewDgrs returns a new instance of Dgrs using the passed dgrs.State.

func (*Dgrs) Channel

func (s *Dgrs) Channel(_ *discordgo.Session, id string) (c *discordgo.Channel, err error)

func (*Dgrs) Guild

func (s *Dgrs) Guild(_ *discordgo.Session, id string) (g *discordgo.Guild, err error)

func (*Dgrs) SelfUser

func (s *Dgrs) SelfUser(_ *discordgo.Session) (u *discordgo.User, err error)

type Internal

type Internal struct{}

Internal implements the state Interface for the internal discordgo.State instance.

func NewInternal

func NewInternal() *Internal

NewInternal returns a new instance of Internal.

func (*Internal) Channel

func (*Internal) Channel(s *discordgo.Session, id string) (c *discordgo.Channel, err error)

func (*Internal) Guild

func (*Internal) Guild(s *discordgo.Session, id string) (g *discordgo.Guild, err error)

func (*Internal) SelfUser

func (*Internal) SelfUser(s *discordgo.Session) (u *discordgo.User, err error)

type State

type State interface {
	// SelfUser returns the user objects of the
	// authenticated user.
	SelfUser(s *discordgo.Session) (*discordgo.User, error)

	// Channel returns a channel object by its ID, whether
	// from cache or fetched from the API when not stored
	// in the state chache.
	Channel(s *discordgo.Session, id string) (*discordgo.Channel, error)

	// Guild returns a guild object by its ID, whether
	// from cache or fetched from the API when not stored
	// in the state chache.
	Guild(s *discordgo.Session, id string) (*discordgo.Guild, error)
}

State defines an implementation of the state cache.

Jump to

Keyboard shortcuts

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