discorb-lib/discorb

View on GitHub
sig/discorb/activity.rbs

Summary

Maintainability
Test Coverage
module Discorb
  #
  # Represents an activity for Gateway Command.
  class Activity
    TYPES: untyped

    type types = :playing | :streaming | :listening | :watching | :custom | :competing

    # @return [String] The text of the activity.
    attr_reader text: String
    # @return [:playing, :streaming, :listening, :watching, :competing] The type of the activity.
    attr_reader type: types
    # @return [String] The URL of the activity.
    attr_reader url: String?

    #
    # Initializes a new Activity.
    #
    # @param [String] text The text of the activity.
    # @param [:playing, :streaming, :listening, :watching, :custom, :competing] type The type of activity.
    # @param [String] url The URL of the activity.
    #
    def initialize: (String text, types type, ?url: String?) -> void

    #
    # Converts the activity to a hash.
    #
    # @return [Hash] A hash representation of the activity.
    def to_hash: -> Discorb::json

    %a{pure}
    def inspect: -> String
  end
end