Class: SeenPlugin

Inherits:
Sponge::Plugin show all
Defined in:
lib/proto/plugins/seen.rb

Constant Summary

Constants inherited from Sponge::Plugin

Sponge::Plugin::AUTH, Sponge::Plugin::LIST, Sponge::Plugin::LISTENERS

Instance Method Summary collapse

Methods inherited from Sponge::Plugin

command, has_listener?, #help, inherited, listen_to, requires_auth, #requires_auth?, #usage

Constructor Details

#initialize(bot) ⇒ SeenPlugin

Returns a new instance of SeenPlugin.



4
5
6
# File 'lib/proto/plugins/seen.rb', line 4

def initialize(bot)
  @users = {}
end

Instance Method Details

#listen(message) ⇒ Object



8
9
10
# File 'lib/proto/plugins/seen.rb', line 8

def listen(message)
  @users[message.nick] = message
end

#reply(m, arg) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/proto/plugins/seen.rb', line 12

def reply(m, arg)
  if @users.include?(arg)
    m.reply "I have seen #{arg}"
  else
    m.reply "I haven't seen #{arg}"
  end
end