DiscordShardDelegate

public protocol DiscordShardDelegate : class, DiscordTokenBearer

Declares that a type will be a shard’s delegate.

  • Used by shards to signal that they have connected.

    Declaration

    Swift

    func shardDidConnect(_ shard: DiscordShard)

    Parameters

    shardNum

    The number of the shard that disconnected.

  • Used by shards to signal that they have disconnected

    Declaration

    Swift

    func shardDidDisconnect(_ shard: DiscordShard)

    Parameters

    shardNum

    The number of the shard that disconnected.

  • Handles engine dispatch events. You shouldn’t need to call this method directly.

    Override to provide custom engine dispatch functionality.

    Declaration

    Swift

    func shard(_ engine: DiscordShard, didReceiveEvent event: DiscordDispatchEvent,

    Parameters

    engine

    The engine that received the event.

    didReceiveEvent

    The event that was received.

    payload

    A DiscordGatewayPayload containing the dispatch information.

  • Called when an engine handled a hello packet.

    • gotHelloWithPayload: The hello data.

    Declaration

    Swift

    func shard(_ engine: DiscordShard, gotHelloWithPayload payload: DiscordGatewayPayload)

    Parameters

    engine

    The engine that received the event.