module Pepito::Handler::ChatRouter

Router for chat messages.

Constants

ChatRoute

A struct representing the route.

Public Instance Methods

chat_route(pattern, func, options = {}) click to toggle source

Add a Pepito::Handler::ChatRoute struct to the chat_routes array. @param pattern [Regexp] Pattern for the chat route. @param func [Symbol] The name of the function to call. @param options [Hash]

command [Boolean] Whether the route is a command or not.
help [String] The string for the help menu.

@return [void]

# File lib/pepito/handler/chat_router.rb, line 20
def chat_route(pattern, func, options = {})
  chat_routes << ChatRoute.new(
    pattern,
    func,
    options.delete(:command) || false,
    options.delete(:help) || nil
  )
end
chat_routes() click to toggle source

List of chat routes. @return [Array<Pepito::Handler::ChatRouter::ChatRoute>]

# File lib/pepito/handler/chat_router.rb, line 31
def chat_routes
  @chat_routes ||= []
end