DiscordGatewayClientBase
Base gateway for clients.
Properties
latency
The latency of the websocket in seconds. If no latency is recorded will return the default latency.
Returns
latency : float
Methods
()
__new__Creates a new gateway
()
abortAbort the gateway immediately.
()
beatSends a heartbeat packet to Discord.
This method is a coroutine.
(guild_id, channel_id, ...)
change_voice_stateSends a VOICE_STATE
packet to Discord.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
guild_id |
| The voice client's guild's id. | |||
channel_id |
| The voice client's channel's id. | |||
self_deaf |
|
| Whether the voice client is deafen. | ||
self_mute |
|
| Whether the voice client is muted. |
()
closeCancels the gateway's heartbeat and closes it's websocket with close code of 1000
.
This method is a coroutine.
(guild_id)
get_gatewayReturns the gateway for the given guild_id
.
Parameter | Type | Description |
---|---|---|
guild_id |
| The guild's identifier to get the gateway for. Can be |
Returns
gateway : DiscordGatewayClientBase
()
runKeeps the gateway receiving message and processing it. If the gateway needs to be reconnected, reconnects itself. If connecting cannot succeed, because there is no internet returns True
. If the .client
is stopped, then returns False
.
If True
is returned the respective client stops all other gateways as well and tries to reconnect. When the internet is back the client will launch back the gateway.
This method is a coroutine.
Returns
outcome : bool<False>
Always False
.
Raises
DiscordGatewayException
The client tries to connect with bad or not acceptable intent or shard value.
DiscordException
(data)
send_as_jsonSends the data as json to Discord on the gateway's websocket. If there is no websocket, or the websocket is closed will not raise.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
data |
| The data to send. |
()
terminateTerminates the gateway's beating and closes it's websocket with close code of 4000
.
This method is a coroutine.
()
_put_repr_parts_intoHelper method to extend repr_parts
with type specific fields.
()
__getattr__Drops a rich attribute error.
()
__repr__Returns the gateway's representation.