Sha256: 590d4da2db492c3f24ace671bbf6d616e31483f23ee3dfb428118ccd83225f37

Contents?: true

Size: 875 Bytes

Versions: 3

Compression:

Stored size: 875 Bytes

Contents

# frozen_string_literal: true

module Calliope
  # Generic class for events.
  module Events
    # Raised when the player state is dispatched.
    class State
      # @return [Client]
      attr_reader :client

      # @return [Integer]
      attr_reader :ping

      # @return [Integer]
      attr_reader :time

      # @return [Integer]
      attr_reader :guild

      # @return [Integer]
      attr_reader :position

      # @return [Boolean]
      attr_reader :connected

      # @!visibility private
      # @param payload [Hash]
      # @param client [Client]
      def initialize(payload, client)
        @client = client
        @guild = payload["GuildId"]
        @ping = payload["state"]["ping"]
        @time = payload["state"]["time"]
        @position = payload["state"]["position"]
        @connected = payload["state"]["connected"]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
calliope-link-1.0.2 lib/calliope/events/state.rb
calliope-link-1.0.1 lib/calliope/events/state.rb
calliope-link-1.0.0 lib/calliope/events/state.rb