1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-27 09:12:53 +00:00

State: remove redundant error return from NewFromSession

This commit is contained in:
mavolin 2020-12-15 16:40:08 +01:00 committed by diamondburned
parent 826b90a5f3
commit 7a7a56d613

View file

@ -110,7 +110,7 @@ func NewWithIntents(token string, intents ...gateway.Intents) (*State, error) {
return nil, err
}
return NewFromSession(s, defaultstore.New())
return NewFromSession(s, defaultstore.New()), nil
}
func NewWithStore(token string, cabinet store.Cabinet) (*State, error) {
@ -119,12 +119,11 @@ func NewWithStore(token string, cabinet store.Cabinet) (*State, error) {
return nil, err
}
return NewFromSession(s, cabinet)
return NewFromSession(s, cabinet), nil
}
// NewFromSession never returns an error. This API is kept for backwards
// compatibility.
func NewFromSession(s *session.Session, cabinet store.Cabinet) (*State, error) {
// NewFromSession creates a new State from the passed Session and Cabinet.
func NewFromSession(s *session.Session, cabinet store.Cabinet) *State {
state := &State{
Session: s,
Cabinet: cabinet,
@ -137,7 +136,7 @@ func NewFromSession(s *session.Session, cabinet store.Cabinet) (*State, error) {
unreadyGuilds: moreatomic.NewGuildIDSet(),
}
state.hookSession()
return state, nil
return state
}
// WithContext returns a shallow copy of State with the context replaced in the