Sha256: 3c75aa69dd2fb4f9241cbf1e87307afd0bc2d40136b6fc5f13b709bab703cb4b

Contents?: true

Size: 943 Bytes

Versions: 33

Compression:

Stored size: 943 Bytes

Contents

module Lita
  # A namespace to hold all subclasses of {Handler}.
  module Handlers
    # Allows administrators to make Lita join and part from rooms.
    # @since 3.0.0
    class Room < Handler
      route(/^join\s+(.+)$/i, :join, command: true, restrict_to: :admins, help: {
        t("help.join_key") => t("help.join_value")
      })

      route(/^part\s+(.+)$/i, :part, command: true, restrict_to: :admins, help: {
        t("help.part_key") => t("help.part_value")
      })

      # Joins the room with the specified ID.
      # @param response [Lita::Response] The response object.
      # @return [void]
      def join(response)
        robot.join(response.args[0])
      end

      # Parts from the room with the specified ID.
      # @param response [Lita::Response] The response object.
      # @return [void]
      def part(response)
        robot.part(response.args[0])
      end
    end

    Lita.register_handler(Room)
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
lita-4.8.0 lib/lita/handlers/room.rb
lita-4.8.0.beta1 lib/lita/handlers/room.rb
lita-4.7.1 lib/lita/handlers/room.rb
lita-4.7.0 lib/lita/handlers/room.rb
lita-4.6.1 lib/lita/handlers/room.rb
lita-4.6.0 lib/lita/handlers/room.rb
lita-4.5.0 lib/lita/handlers/room.rb
lita-4.4.3 lib/lita/handlers/room.rb
lita-4.4.2 lib/lita/handlers/room.rb
lita-4.4.1 lib/lita/handlers/room.rb
lita-4.4.0 lib/lita/handlers/room.rb
lita-4.3.2 lib/lita/handlers/room.rb
lita-4.3.1 lib/lita/handlers/room.rb
lita-4.3.0 lib/lita/handlers/room.rb
lita-4.2.1 lib/lita/handlers/room.rb
lita-4.2.0 lib/lita/handlers/room.rb
lita-4.1.0 lib/lita/handlers/room.rb
lita-4.0.4 lib/lita/handlers/room.rb
lita-4.0.3 lib/lita/handlers/room.rb
lita-4.0.2 lib/lita/handlers/room.rb