Class: Cinch::Plugins::Seen
- Inherits:
-
Object
- Object
- Cinch::Plugins::Seen
- Includes:
- Cinch::Plugin
- Defined in:
- lib/cinch/plugins/seen.rb,
lib/cinch/plugins/seen/version.rb
Overview
Versioning Info
Defined Under Namespace
Classes: Activity
Constant Summary collapse
- VERSION =
'1.0.5'
Instance Method Summary collapse
- #execute(m, nick) ⇒ Object
-
#initialize(*args) ⇒ Seen
constructor
A new instance of Seen.
- #listen(m) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Seen
Returns a new instance of Seen.
22 23 24 25 26 |
# File 'lib/cinch/plugins/seen.rb', line 22 def initialize(*args) super @storage = Cinch::Storage.new(config[:filename] || 'yaml/seen.yml') @storage.data ||= {} end |
Instance Method Details
#execute(m, nick) ⇒ Object
37 38 39 40 41 |
# File 'lib/cinch/plugins/seen.rb', line 37 def execute(m, nick) return if Cinch::Toolbox.(m) || m.user.nick.downcase == nick.downcase m.reply last_seen(m.channel.name, nick), true end |
#listen(m) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/cinch/plugins/seen.rb', line 28 def listen(m) channel = m.channel.name nick = m.user.nick @storage.data[channel] ||= {} @storage.data[channel][nick.downcase] = Activity.new(nick, Time.now, m.) @storage.synced_save(@bot) end |