module Discorb # # Represents a presence of user. class Presence < Discorb::DiscordModel # # Initialize a presence. # @private # # @param [Discorb::Client] client The client. # @param [Hash] data The data of the presence. def initialize: (Discorb::Client client, Discorb::json data) -> void %a{pure} def inspect: -> String # @return [:online, :idle, :dnd, :offline] The status of the user. attr_reader status: Symbol # @return [Array] The activities of the user. attr_reader activities: ::Array[Discorb::Presence::Activity] # @return [Discorb::Presence::ClientStatus] The client status of the user. attr_reader client_status: Discorb::Presence::ClientStatus # @return [Discorb::User] The user of the presence. attr_reader user: Discorb::User # @return [Discorb::Guild] The guild of the presence. attr_reader guild: Discorb::Guild # @return [Discorb::Presence::Activity] The activity of the presence. attr_reader activity: Discorb::Presence::Activity # # Represents an activity of a user. class Activity < Discorb::DiscordModel ACTIVITY_TYPES: untyped # # Initialize the activity. # @private # # @param [Hash] data The activity data. def initialize: (Discorb::json data) -> void # # Convert the activity to a string. # # @return [String] The string representation of the activity. %a{pure} def to_s: -> String # @return [String] The name of the activity. attr_reader name: String # @return [:game, :streaming, :listening, :watching, :custom, :competing] The type of the activity. attr_reader type: Symbol # @return [String] The url of the activity. attr_reader url: String # @return [Time] The time the activity was created. attr_reader created_at: Time # @return [Discorb::Presence::Activity::Timestamps] The timestamps of the activity. attr_reader timestamps: Discorb::Presence::Activity::Timestamps # @return [Discorb::Snowflake] The application id of the activity. attr_reader application_id: Discorb::Snowflake # @return [String] The details of the activity. attr_reader details: String # @return [String] The state of party. attr_reader state: String # @return [Discorb::Emoji] The emoji of the activity. attr_reader emoji: Discorb::emoji? # @return [Discorb::Presence::Activity::Party] The party of the activity. # @return [nil] If the activity is not a party activity. attr_reader party: Discorb::Presence::Activity::Party? # @return [Discorb::Presence::Activity::Asset] The assets of the activity. # @return [nil] If the activity has no assets. attr_reader assets: Discorb::Presence::Activity::Asset? # @return [Discorb::StageInstance] The instance of the activity. # @return [nil] If the activity is not a stage activity. attr_reader instance: Discorb::StageInstance? # @return [Array] The buttons of the activity. # @return [nil] If the activity has no buttons. attr_reader buttons: ::Array[Discorb::Presence::Activity::Button]? # @return [Discorb::Presence::Activity::Flag] The flags of the activity. attr_reader flags: Discorb::Presence::Activity::Flag # # Represents the timestamps of an activity. class Timestamps < Discorb::DiscordModel # # Initialize the timestamps. # @private # # @param [Hash] data The timestamps data. def initialize: (Discorb::json data) -> void # @return [Time] The start time of the activity. attr_reader start: Time # @return [Time] The end time of the activity. attr_reader end: Time end # # Represents the party of an activity. class Party < Discorb::DiscordModel # # Initialize the party. # @private # # @param [Hash] data The party data. def initialize: (Discorb::json data) -> void # @return [String] The id of the party. attr_reader id: String # @return [Integer] The current size of the party. attr_reader current_size: Integer # @return [Integer] The max size of the party. attr_reader max_size: Integer end # # Represents the assets of an activity. class Asset < Discorb::DiscordModel def initialize: (untyped data) -> void # @return [String] The large image ID or URL of the asset. attr_reader large_image: String # @return [String] The large text of the activity. attr_reader large_text: String # @return [String] The small image ID or URL of the activity. attr_reader small_image: String # @return [String] The small text of the activity. attr_reader small_text: String end # # Represents the flags of an activity. # ## Flag fields # |`1 << 0`|`:instance`| # |`1 << 1`|`:join`| # |`1 << 2`|`:spectate`| # |`1 << 3`|`:join_request`| # |`1 << 4`|`:sync`| # |`1 << 5`|`:play`| class Flag < Discorb::Flag attr_accessor instance: bool attr_accessor join: bool attr_accessor spectate: bool attr_accessor join_request: bool attr_accessor sync: bool attr_accessor play: bool end # # Represents a secrets of an activity. class Secrets < Discorb::DiscordModel # # Initialize the secrets. # @private # # @param [Hash] data The secrets data. def initialize: (Discorb::json data) -> void # @return [String] The join secret of the activity. attr_reader join: String # @return [String] The spectate secret of the activity. attr_reader spectate: String # @return [String] The match secret of the activity. attr_reader match: String end # # Represents a button of an activity. class Button < Discorb::DiscordModel # # Initialize the button. # @private # # @param [Hash] data The button data. def initialize: (Discorb::json data) -> void # @return [String] The text of the button. attr_reader label: String # @return [String] The URL of the button. attr_reader url: String end end # # Represents a user's client status. class ClientStatus < Discorb::DiscordModel # # Initialize the client status. # @private # # @param [Hash] data The client status data. def initialize: (Discorb::json data) -> void # @return [Symbol] The desktop status of the user. attr_reader desktop: Symbol # @return [Symbol] The mobile status of the user. attr_reader mobile: Symbol # @return [Symbol] The web status of the user. attr_reader web: Symbol # @return [Boolean] Whether the user is not offline on desktop. attr_reader desktop?: bool # @return [Boolean] Whether the user is not offline on mobile. attr_reader mobile?: bool # @return [Boolean] Whether the user is not offline on web. attr_reader web?: bool end end end