defaultstore

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: ISC Imports: 6 Imported by: 3

Documentation

Overview

Package defaultstore provides thread-safe store implementations that store state values in memory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffMessage

func DiffMessage(src discord.Message, dst *discord.Message)

DiffMessage fills non-empty fields from src to dst.

func New

func New() store.Cabinet

New creates a new cabinet instance of defaultstore. For Message, it creates a Message store with a limit of 100 messages.

Types

type Channel

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

func NewChannel

func NewChannel() *Channel

func (*Channel) Channel

func (s *Channel) Channel(id discord.ChannelID) (*discord.Channel, error)

func (*Channel) ChannelRemove

func (s *Channel) ChannelRemove(channel discord.Channel) error

func (*Channel) ChannelSet

func (s *Channel) ChannelSet(channel discord.Channel) error

ChannelSet sets the Direct Message or Guild channel into the state.

func (*Channel) Channels

func (s *Channel) Channels(guildID discord.GuildID) ([]discord.Channel, error)

Channels returns a list of Guild channels randomly ordered.

func (*Channel) CreatePrivateChannel

func (s *Channel) CreatePrivateChannel(recipient discord.UserID) (*discord.Channel, error)

func (*Channel) PrivateChannels

func (s *Channel) PrivateChannels() ([]discord.Channel, error)

PrivateChannels returns a list of Direct Message channels randomly ordered.

func (*Channel) Reset

func (s *Channel) Reset() error

type Emoji

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

func NewEmoji

func NewEmoji() *Emoji

func (*Emoji) Emoji

func (s *Emoji) Emoji(guildID discord.GuildID, emojiID discord.EmojiID) (*discord.Emoji, error)

func (*Emoji) EmojiSet

func (s *Emoji) EmojiSet(guildID discord.GuildID, allEmojis []discord.Emoji) error

func (*Emoji) Emojis

func (s *Emoji) Emojis(guildID discord.GuildID) ([]discord.Emoji, error)

func (*Emoji) Reset

func (s *Emoji) Reset() error

type Guild

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

func NewGuild

func NewGuild() *Guild

func (*Guild) Guild

func (s *Guild) Guild(id discord.GuildID) (*discord.Guild, error)

func (*Guild) GuildRemove

func (s *Guild) GuildRemove(id discord.GuildID) error

func (*Guild) GuildSet

func (s *Guild) GuildSet(guild discord.Guild) error

func (*Guild) Guilds

func (s *Guild) Guilds() ([]discord.Guild, error)

func (*Guild) Reset

func (s *Guild) Reset() error

type Me

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

func NewMe

func NewMe() *Me

func (*Me) Me

func (m *Me) Me() (*discord.User, error)

func (*Me) MyselfSet

func (m *Me) MyselfSet(me discord.User) error

func (*Me) Reset

func (m *Me) Reset() error

type Member

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

func NewMember

func NewMember() *Member

func (*Member) Member

func (s *Member) Member(guildID discord.GuildID, userID discord.UserID) (*discord.Member, error)

func (*Member) MemberRemove

func (s *Member) MemberRemove(guildID discord.GuildID, userID discord.UserID) error

func (*Member) MemberSet

func (s *Member) MemberSet(guildID discord.GuildID, member discord.Member) error

func (*Member) Members

func (s *Member) Members(guildID discord.GuildID) ([]discord.Member, error)

func (*Member) Reset

func (s *Member) Reset() error

type Message

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

func NewMessage

func NewMessage(maxMsgs int) *Message

func (*Message) MaxMessages

func (s *Message) MaxMessages() int

func (*Message) Message

func (s *Message) Message(chID discord.ChannelID, mID discord.MessageID) (*discord.Message, error)

func (*Message) MessageRemove

func (s *Message) MessageRemove(channelID discord.ChannelID, messageID discord.MessageID) error

func (*Message) MessageSet

func (s *Message) MessageSet(message discord.Message) error

func (*Message) Messages

func (s *Message) Messages(channelID discord.ChannelID) ([]discord.Message, error)

func (*Message) Reset

func (s *Message) Reset() error

type Presence

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

func NewPresence

func NewPresence() *Presence

func (*Presence) Presence

func (s *Presence) Presence(gID discord.GuildID, uID discord.UserID) (*gateway.Presence, error)

func (*Presence) PresenceRemove

func (s *Presence) PresenceRemove(guildID discord.GuildID, userID discord.UserID) error

func (*Presence) PresenceSet

func (s *Presence) PresenceSet(guildID discord.GuildID, presence gateway.Presence) error

func (*Presence) Presences

func (s *Presence) Presences(guildID discord.GuildID) ([]gateway.Presence, error)

func (*Presence) Reset

func (s *Presence) Reset() error

type Role

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

func NewRole

func NewRole() *Role

func (*Role) Reset

func (s *Role) Reset() error

func (*Role) Role

func (s *Role) Role(guildID discord.GuildID, roleID discord.RoleID) (*discord.Role, error)

func (*Role) RoleRemove

func (s *Role) RoleRemove(guildID discord.GuildID, roleID discord.RoleID) error

func (*Role) RoleSet

func (s *Role) RoleSet(guildID discord.GuildID, role discord.Role) error

func (*Role) Roles

func (s *Role) Roles(guildID discord.GuildID) ([]discord.Role, error)

type VoiceState

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

func NewVoiceState

func NewVoiceState() *VoiceState

func (*VoiceState) Reset

func (s *VoiceState) Reset() error

func (*VoiceState) VoiceState

func (s *VoiceState) VoiceState(
	guildID discord.GuildID, userID discord.UserID) (*discord.VoiceState, error)

func (*VoiceState) VoiceStateRemove

func (s *VoiceState) VoiceStateRemove(guildID discord.GuildID, userID discord.UserID) error

func (*VoiceState) VoiceStateSet

func (s *VoiceState) VoiceStateSet(guildID discord.GuildID, voiceState discord.VoiceState) error

func (*VoiceState) VoiceStates

func (s *VoiceState) VoiceStates(guildID discord.GuildID) ([]discord.VoiceState, error)

Jump to

Keyboard shortcuts

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