mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-07-23 13:20:51 +00:00
Compare commits
2 commits
826b90a5f3
...
9a820c3749
Author | SHA1 | Date | |
---|---|---|---|
|
9a820c3749 | ||
|
7a7a56d613 |
|
@ -5,7 +5,7 @@
|
||||||
"CGO_ENABLED": "1", # for the race detector
|
"CGO_ENABLED": "1", # for the race detector
|
||||||
"COV": "/tmp/cov_results",
|
"COV": "/tmp/cov_results",
|
||||||
"dismock": "github.com/mavolin/dismock/v2/pkg/dismock",
|
"dismock": "github.com/mavolin/dismock/v2/pkg/dismock",
|
||||||
"dismock_v": "5c8df6ab93b919264ab156416c5803fb44491661",
|
"dismock_v": "dc1c2e57a55d86999fa054f06ccc3665cbf7a3bd",
|
||||||
# used only in integration_test
|
# used only in integration_test
|
||||||
"tested": "./api,./gateway,./bot,./discord"
|
"tested": "./api,./gateway,./bot,./discord"
|
||||||
},
|
},
|
||||||
|
|
|
@ -110,7 +110,7 @@ func NewWithIntents(token string, intents ...gateway.Intents) (*State, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewFromSession(s, defaultstore.New())
|
return NewFromSession(s, defaultstore.New()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWithStore(token string, cabinet store.Cabinet) (*State, error) {
|
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 nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewFromSession(s, cabinet)
|
return NewFromSession(s, cabinet), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFromSession never returns an error. This API is kept for backwards
|
// NewFromSession creates a new State from the passed Session and Cabinet.
|
||||||
// compatibility.
|
func NewFromSession(s *session.Session, cabinet store.Cabinet) *State {
|
||||||
func NewFromSession(s *session.Session, cabinet store.Cabinet) (*State, error) {
|
|
||||||
state := &State{
|
state := &State{
|
||||||
Session: s,
|
Session: s,
|
||||||
Cabinet: cabinet,
|
Cabinet: cabinet,
|
||||||
|
@ -137,7 +136,7 @@ func NewFromSession(s *session.Session, cabinet store.Cabinet) (*State, error) {
|
||||||
unreadyGuilds: moreatomic.NewGuildIDSet(),
|
unreadyGuilds: moreatomic.NewGuildIDSet(),
|
||||||
}
|
}
|
||||||
state.hookSession()
|
state.hookSession()
|
||||||
return state, nil
|
return state
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithContext returns a shallow copy of State with the context replaced in the
|
// WithContext returns a shallow copy of State with the context replaced in the
|
||||||
|
|
Loading…
Reference in a new issue