Class: Cinch::Plugins::LastActive
- Inherits:
-
Object
- Object
- Cinch::Plugins::LastActive
- Includes:
- Cinch::Plugin
- Defined in:
- lib/cinch/plugins/lastactive.rb,
lib/cinch/plugins/lastactive/version.rb
Overview
Versioning Information
Constant Summary collapse
- VERSION =
'1.0.0'
Instance Method Summary collapse
-
#initialize(*args) ⇒ LastActive
constructor
A new instance of LastActive.
- #join_respond(m) ⇒ Object
- #update_time(m) ⇒ Object
Constructor Details
#initialize(*args) ⇒ LastActive
Returns a new instance of LastActive.
14 15 16 17 |
# File 'lib/cinch/plugins/lastactive.rb', line 14 def initialize(*args) super @times = Hash.new(Time.now) end |
Instance Method Details
#join_respond(m) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/cinch/plugins/lastactive.rb', line 19 def join_respond(m) return if m.user.nick == @bot.nick return if m.channel.nil? m.reply "Hello, #{m.user.nick}. The last activity was " \ "#{time_passed(m.channel.name)} ago." end |
#update_time(m) ⇒ Object
26 27 28 |
# File 'lib/cinch/plugins/lastactive.rb', line 26 def update_time(m) @times[m.channel.name] = Time.now end |