Class: Cinch::Plugins::LastSeen

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/cinch/plugins/last_seen.rb

Defined Under Namespace

Classes: LoggedMessage

Instance Method Summary (collapse)

Constructor Details

- (LastSeen) initialize(*args)



12
13
14
15
# File 'lib/cinch/plugins/last_seen.rb', line 12

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

Instance Method Details

- (Object) check_nick(m, nick)



24
25
26
27
28
29
30
31
# File 'lib/cinch/plugins/last_seen.rb', line 24

def check_nick(m, nick)
  message = @logged_messages[nick]
  if message
    m.reply "I've last seen #{nick} at #{message.time} in #{message.channel} saying: #{message.message}", true
  else
    m.reply "I haven't seen #{nick}, sorry.", true
  end
end

- (Object) log_message(m)



18
19
20
21
# File 'lib/cinch/plugins/last_seen.rb', line 18

def log_message(m)
  return unless log_channel?(m.channel)
  @logged_messages[m.user.nick] = LoggedMessage.new(m.user.nick, m.channel.to_s, m.message, Time.now)
end