Class: Pepito::Handlers::Room

Inherits:
Pepito::Handler show all
Defined in:
lib/pepito/handlers/room.rb

Overview

Handler to manage rooms options

Instance Attribute Summary

Attributes inherited from Pepito::Handler

#robot

Instance Method Summary collapse

Methods inherited from Pepito::Handler

#initialize, #start

Methods included from Pepito::Handler::ChatRouter

#chat_route, #chat_routes

Methods included from Pepito::Handler::HTTPRouter

#http_route, #http_routes

Constructor Details

This class inherits a constructor from Pepito::Handler

Instance Method Details

#chat_set_topic(source, match_data) ⇒ nil

Set topic

Parameters:

  • source (Pepito::Source)

    Where the message came from

  • match_data (MatchData)

    Match data for the regexp pattern.

Returns:

  • (nil)


17
18
19
20
# File 'lib/pepito/handlers/room.rb', line 17

def chat_set_topic(source, match_data)
  source.adapter.topic(source, match_data['topic'])
  nil
end

#runvoid

This method returns an undefined value.

Run the handler.



9
10
11
# File 'lib/pepito/handlers/room.rb', line 9

def run
  chat_route(/^set topic (?<topic>.*)$/i, :chat_set_topic, command: true, help: "set topic [topic] -> change the channel's topic")
end