mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-01 04:24:19 +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)
|
gw := ws.NewGateway(ws.NewWebsocket(ws.NewCodec(OpUnmarshalers), gatewayURL), opts)
|
||||||
|
|
||||||
return &Gateway{
|
return &Gateway{
|
||||||
gateway: gw,
|
gateway: gw,
|
||||||
state: state,
|
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
|
// State returns a copy of the gateway's internal state. It panics if the
|
||||||
// gateway is currently running.
|
// gateway is currently running.
|
||||||
func (g *Gateway) State() State {
|
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.
|
// Send is a function to send an Op payload to the Gateway.
|
||||||
func (g *Gateway) Send(ctx context.Context, data Event) error {
|
func (g *Gateway) Send(ctx context.Context, data Event) error {
|
||||||
op := Op{
|
op := Op{
|
||||||
|
|
Loading…
Reference in a new issue