state

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 2 Imported by: 3

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) Role added in v0.3.0

func (s *Dgrs) Role(_ *discordgo.Session, gID, id string) (r *discordgo.Role, err error)

func (*Dgrs) SelfUser

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

func (*Dgrs) User added in v0.3.0

func (s *Dgrs) User(_ *discordgo.Session, id string) (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) Role added in v0.3.0

func (*Internal) Role(s *discordgo.Session, gID, id string) (r *discordgo.Role, err error)

func (*Internal) SelfUser

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

func (*Internal) User added in v0.3.0

func (*Internal) User(s *discordgo.Session, id string) (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)

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

	// User returns a user object by its ID, whether
	// from cache or fetched from the API when not stored
	// in the state chache.
	User(s *discordgo.Session, id string) (*discordgo.User, 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