mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-27 17:23:00 +00:00
gateway: Expose GatewayOpts getter
This commit is contained in:
parent
78ad477b83
commit
5a156cc699
|
@ -171,13 +171,17 @@ func NewFromState(gatewayURL string, state State, opts *ws.GatewayOpts) *Gateway
|
|||
}
|
||||
|
||||
gw := ws.NewGateway(ws.NewWebsocket(ws.NewCodec(OpUnmarshalers), gatewayURL), opts)
|
||||
|
||||
return &Gateway{
|
||||
gateway: gw,
|
||||
state: state,
|
||||
}
|
||||
}
|
||||
|
||||
// Opts returns a copy of the gateway options that are being used.
|
||||
func (g *Gateway) Opts() *ws.GatewayOpts {
|
||||
return g.gateway.Opts()
|
||||
}
|
||||
|
||||
// State returns a copy of the gateway's internal state. It panics if the
|
||||
// gateway is currently running.
|
||||
func (g *Gateway) State() State {
|
||||
|
|
|
@ -159,6 +159,13 @@ func NewGateway(ws *Websocket, opts *GatewayOpts) *Gateway {
|
|||
}
|
||||
}
|
||||
|
||||
// Opts returns a copy of the gateway options. The options can only be changed
|
||||
// during construction, so a copy is a must.
|
||||
func (g *Gateway) Opts() *GatewayOpts {
|
||||
cpy := g.opts
|
||||
return &cpy
|
||||
}
|
||||
|
||||
// Send is a function to send an Op payload to the Gateway.
|
||||
func (g *Gateway) Send(ctx context.Context, data Event) error {
|
||||
op := Op{
|
||||
|
|
Loading…
Reference in a new issue