1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-07-23 05:11:44 +00:00

Compare commits

...

2 commits

Author SHA1 Message Date
diamondburned 9a820c3749 CI: Update Dismock 2020-12-15 14:16:12 -08:00
mavolin 7a7a56d613 State: remove redundant error return from NewFromSession 2020-12-15 08:32:18 -08:00
2 changed files with 6 additions and 7 deletions

View file

@ -5,7 +5,7 @@
"CGO_ENABLED": "1", # for the race detector
"COV": "/tmp/cov_results",
"dismock": "github.com/mavolin/dismock/v2/pkg/dismock",
"dismock_v": "5c8df6ab93b919264ab156416c5803fb44491661",
"dismock_v": "dc1c2e57a55d86999fa054f06ccc3665cbf7a3bd",
# used only in integration_test
"tested": "./api,./gateway,./bot,./discord"
},

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