DiscordActivity

public struct DiscordActivity : Encodable

Represents a game

  • The application id.

    Declaration

    Swift

    public let applicationId: String?
  • The assets for this activity.

    Declaration

    Swift

    public let assets: DiscordActivityAssets?
  • What the player is currently doing.

    Declaration

    Swift

    public let details: String?
  • The name of the game.

    Declaration

    Swift

    public let name: String
  • The party status.

    Declaration

    Swift

    public let party: DiscordParty?
  • The user’s current party status

    Declaration

    Swift

    public let state: String?
  • Unix timestamps for the start and end of a game.

    Declaration

    Swift

    public let timestamps: DiscordActivityTimestamps?
  • The type of the game.

    Declaration

    Swift

    public let type: DiscordActivityType
  • url

    The url of the stream, if a stream.

    Declaration

    Swift

    public let url: String?
  • Creates a new DiscordGame.

    Declaration

    Swift

    public init(name: String, type: DiscordActivityType, url: String? = nil)

    Parameters

    name

    The name of the game

    type

    The type of the game

    url

    The url of the stream, if a stream

  • Creates a new DiscordGame from a json object.

    Can fail if no game object was given.

    Declaration

    Swift

    public init?(gameObject: [String: Any]?)

    Parameters

    gameObject

    The json game

  • Encodable requirement

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws