Moved State struct to state.go
This commit is contained in:
parent
d69fac5eae
commit
bda7434f18
2 changed files with 14 additions and 14 deletions
12
state.go
12
state.go
|
@ -17,6 +17,18 @@ import "errors"
|
||||||
// ErrNilState is returned when the state is nil.
|
// ErrNilState is returned when the state is nil.
|
||||||
var ErrNilState = errors.New("State not instantiated, please use discordgo.New() or assign Session.State.")
|
var ErrNilState = errors.New("State not instantiated, please use discordgo.New() or assign Session.State.")
|
||||||
|
|
||||||
|
// A State contains the current known state.
|
||||||
|
// As discord sends this in a READY blob, it seems reasonable to simply
|
||||||
|
// use that struct as the data store.
|
||||||
|
type State struct {
|
||||||
|
sync.RWMutex
|
||||||
|
Ready
|
||||||
|
MaxMessageCount int
|
||||||
|
|
||||||
|
guildMap map[string]*Guild
|
||||||
|
channelMap map[string]*Channel
|
||||||
|
}
|
||||||
|
|
||||||
// NewState creates an empty state.
|
// NewState creates an empty state.
|
||||||
func NewState() *State {
|
func NewState() *State {
|
||||||
return &State{
|
return &State{
|
||||||
|
|
12
structs.go
12
structs.go
|
@ -393,18 +393,6 @@ type UserGuildSettings struct {
|
||||||
ChannelOverrides []*UserGuildSettingsChannelOverride `json:"channel_overrides"`
|
ChannelOverrides []*UserGuildSettingsChannelOverride `json:"channel_overrides"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// A State contains the current known state.
|
|
||||||
// As discord sends this in a READY blob, it seems reasonable to simply
|
|
||||||
// use that struct as the data store.
|
|
||||||
type State struct {
|
|
||||||
sync.RWMutex
|
|
||||||
Ready
|
|
||||||
MaxMessageCount int
|
|
||||||
|
|
||||||
guildMap map[string]*Guild
|
|
||||||
channelMap map[string]*Channel
|
|
||||||
}
|
|
||||||
|
|
||||||
// Constants for the different bit offsets of text channel permissions
|
// Constants for the different bit offsets of text channel permissions
|
||||||
const (
|
const (
|
||||||
PermissionReadMessages = 1 << (iota + 10)
|
PermissionReadMessages = 1 << (iota + 10)
|
||||||
|
|
Loading…
Reference in a new issue