discorb-lib/discorb

View on GitHub
sig/discorb/interaction/command.rbs

Summary

Maintainability
Test Coverage
module Discorb
  #
  # Represents a command interaction.
  class CommandInteraction < Discorb::Interaction
    include Discorb::Interaction::SourceResponder
    include Discorb::Interaction::ModalResponder

    #
    # Creates a new CommandInteraction instance for the given data.
    # @private
    #
    # @param [Discorb::Client] client The client.
    # @param [Hash] data The data for the command.
    def self.make_interaction: (
      Discorb::Client client,
      Discorb::json data
    ) -> untyped

    #
    # Returns the classes under this class.
    # @private
    def self.nested_classes: -> untyped

    #
    # Represents a slash command interaction.
    class ChatInputCommand < Discorb::CommandInteraction
      #
      # Get command data from the given data.
      # @private
      #
      # @param [Hash] data The data of the command.
      def self.get_command_data: (Discorb::json data) -> untyped

      #
      # Modify the option map with the given options.
      # @private
      #
      # @param [Hash] option_map The option map to modify.
      # @param [Array<Hash>] options The options for modifying.
      # @param [Discorb::Guild] guild The guild where the command is executed.
      # @param [{Discorb::Snowflake => Discorb::Member}] members The cached members of the guild.
      # @param [{Integer => Discorb::Attachment}] attachments The cached attachments of the message.
      def self.modify_option_map: (
        ::Hash[untyped, untyped] option_map,
        ::Array[::Hash[untyped, untyped]] options,
        Discorb::Guild? guild,
        ::Hash[Discorb::Snowflake, Discorb::Member] members,
        ::Hash[Integer, Discorb::Attachment] attachments
      ) -> untyped
    end

    #
    # Represents a user context menu interaction.
    class UserMenuCommand < Discorb::CommandInteraction
      # @return [Discorb::Member, Discorb::User] The target user.
      attr_reader target: Discorb::Member | Discorb::User
    end

    #
    # Represents a message context menu interaction.
    class MessageMenuCommand < Discorb::CommandInteraction
      # @return [Discorb::Message] The target message.
      attr_reader target: Discorb::Message
    end
  end
end