Class: Lita::Adapters::IRC::CinchPlugin

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/lita/adapters/irc/cinch_plugin.rb

Instance Method Summary collapse

Instance Method Details

#execute(m) ⇒ Object


13
14
15
16
17
18
19
# File 'lib/lita/adapters/irc/cinch_plugin.rb', line 13

def execute(m)
  body = get_body(m)
  source = get_source(m)
  message = Message.new(robot, body, source)
  message.command! unless source.room
  dispatch(message)
end

#on_connect(m) ⇒ Object


21
22
23
# File 'lib/lita/adapters/irc/cinch_plugin.rb', line 21

def on_connect(m)
  robot.trigger(:connected)
end

#on_invite(m) ⇒ Object


25
26
27
28
# File 'lib/lita/adapters/irc/cinch_plugin.rb', line 25

def on_invite(m)
  user = user_by_nick(m.user.nick)
  m.channel.join if Lita::Authorization.user_is_admin?(user)
end