Method: Cinch::Plugin::ClassMethods#listen_to

Defined in:
lib/cinch/plugin.rb

#listen_to(*types, options = {}) ⇒ Array<Listener>

Events to listen to.

Parameters:

  • *types (String, Symbol, Integer)

    Events to listen to. Available events are all IRC commands in lowercase as symbols, all numeric replies and all events listed in the list of events.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :method (Symbol) — default: :listen

    The method to execute

Returns:



231
232
233
234
235
236
237
238
239
240
241
# File 'lib/cinch/plugin.rb', line 231

def listen_to(*types)
  options = {:method => :listen}
  if types.last.is_a?(Hash)
    options.merge!(types.pop)
  end

  listeners = types.map {|type| Listener.new(type.to_s.to_sym, options[:method])}
  @listeners.concat listeners

  listeners
end