Shard class

Shard is single connection to discord gateway. Since bots can grow big, handling thousand of guild on same websocket connections would be very hand. Traffic can be split into different connections which can be run on different processes or even different machines.

Implemented types

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
final
hashCode int
The hash code for this object.
no setterinherited
id int
Id of shard
final
manager ShardManager
Reference to ShardManager
final
onDisconnect Stream<Shard>
Emitted when the shard encounters a connection error
latefinal
onMemberChunk Stream<MemberChunkEvent>
Emitted when shard receives member chunk.
latefinal
onResume Stream<Shard>
Emitted when the shard resumed its connection
latefinal
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 Guild with given guildId
dispose() Future<void>
Perform cleanup
override
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