Class: Descartes::Seen

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/descartes/modules/seen.rb

Defined Under Namespace

Classes: SeenStruct

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Seen

Returns a new instance of Seen.



28
29
30
31
# File 'lib/descartes/modules/seen.rb', line 28

def initialize(*args)
  super
  @users = {}
end

Instance Method Details

#execute(m, nick) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/descartes/modules/seen.rb', line 37

def execute(m, nick)
  if nick == @bot.nick
    m.reply "That's me!"
  elsif nick == m.user.nick
    m.reply "That's you!"
  elsif @users.key?(nick)
    m.reply @users[nick].to_s
  else
    m.reply "I haven't seen #{nick}"
  end
end

#listen(m) ⇒ Object



33
34
35
# File 'lib/descartes/modules/seen.rb', line 33

def listen(m)
  @users[m.user.nick] = SeenStruct.new(m.user, m.channel, m.message, Time.now)
end