Skip to main content

Module gateway

Module gateway 

Source
Expand description

The gateway: opcodes, intents, close codes, payloads and events.

This module contains only data types. The connection itself lives in the djs-gateway crate.

Modules§

payload
The data (d field) of gateway payloads.

Structs§

Activity
An activity: a game, stream, song, custom status, … shown in a user’s presence.
ActivityAssets
The images of an activity and their hover texts.
ActivityEmoji
The emoji of a custom status.
ActivityFlags
Flags of an activity: what the activity supports (joining, spectating, …).
ActivityParty
The player’s party.
ActivitySecrets
The Rich Presence secrets of an activity.
ActivityTimestamps
When an Activity started and ends (both: a time bar for listening and watching).
ClientStatus
A user’s status per platform; a platform is None when the user is offline or invisible there.
GatewayEventDeserializer
A DeserializeSeed that decodes a gateway payload into a GatewayEvent.
Intents
Gateway intents: the groups of events a client subscribes to when identifying.
Presence
A user’s presence: their status and activities in a guild.
PresenceUser
The partial user of a Presence (D-074): only id is guaranteed; the other fields are present when they changed. None means “not sent” (or null).
ShardId
Identifies a shard: its number and the total number of shards.

Enums§

ActivityType
The kind of an activity.
CloseCode
A gateway close event code: the reason Discord gives when it closes the WebSocket connection.
DispatchEvent
The event carried by a GatewayEvent::Dispatch: every documented dispatch event, with its own payload type (D-073) from payload.
GatewayEvent
A payload received from the gateway, decoded according to its opcode.
OpCode
A gateway opcode: the op field of every gateway payload.
Status
The online status of a user.
StatusDisplayType
Which field is shown as the status text in the member list.

Constants§

API_VERSION
The Discord API version targeted by this crate (and by discord.js v14).