IShard class abstract
A connection to the Discord Gateway.
One client can have multiple shards. Each shard moves the decompressing and decoding steps of the Gateway connection to their own thread which can lessen the load on the main thread for large bots which might receive thousands of events per minute.
- Implemented types
Constructors
- IShard()
Properties
- connected → bool
-
Returns true if shard is connected to websocket
no setter
- gatewayLatency → Duration
-
Gets the latest gateway latency.
no setter
-
guilds
→ List<
Snowflake> -
List of handled guild ids
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → int
-
The ID of this shard.
no setter
- manager → IShardManager
-
Reference to
ShardManager
no setter -
onDisconnect
→ Stream<
IShard> -
Emitted when the shard encounters a connection error
no setter
-
onMemberChunk
→ Stream<
IMemberChunkEvent> -
Emitted when shard receives member chunk.
no setter
-
onResume
→ Stream<
IShard> -
Emitted when the shard resumed its connection
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
changeVoiceState(
Snowflake? guildId, Snowflake? channelId, {bool selfMute = false, bool selfDeafen = false}) → void -
Updates clients voice state for IGuild with given
guildId
-
dispose(
) → Future< void> -
Perform cleanup
inherited
-
guildSync(
) → void - Syncs all guilds
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestMembers(
dynamic guild, {String? query, Iterable< Snowflake> ? userIds, int limit = 0, bool presences = false, String? nonce}) → void -
Allows to request members objects from gateway
guild
can be either Snowflake or Iterable -
send(
int opCode, dynamic d) → void - Sends WS data.
-
setPresence(
PresenceBuilder presenceBuilder) → void - Allows to set presence for current shard.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited