Sha256: e0c8aeba68da24f303817f9fbfa3d97452d0a5d5e34fe455457d3b31cf3550b3

Contents?: true

Size: 813 Bytes

Versions: 2

Compression:

Stored size: 813 Bytes

Contents

module Discorb
  #
  # @abstract
  # Represents a Discord component.
  class Component
    %a{pure}
    def inspect: -> String

    #
    # Create a new component from hash data.
    #
    # @see https://discord.com/developers/docs/interactions/message-components Official Discord API documentation
    # @param [Hash] data Hash data.
    #
    # @return [Component] A new component.
    def self.from_hash: (Discorb::json data) -> Component

    #
    # Convert components to a hash.
    #
    # @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components Components.
    #
    # @return [Array<Hash>] Hash data.
    def self.to_payload: (
      ::Array[Discorb::Component]
      | ::Array[::Array[Discorb::Component]] components
    ) -> Discorb::json
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discorb-0.20.0 sig/discorb/component/base.rbs
discorb-0.19.0 sig/discorb/component/base.rbs