cinch-lastactive 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cinch/plugins/lastactive.rb +6 -5
- data/lib/cinch/plugins/lastactive/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1038a7084112cee8178cc986209fc7dc8ab113fa
|
|
4
|
+
data.tar.gz: 89a413dea4e523e856c534cab66079d2814446df
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44bb8d0c3a42767e5fbaee8a717b742fcaea4383be21be1f8ab89741b9b36c807e4c80bafe001f2843498da5c7f82e41e3d20e4eba968c47524856f6770f45b4
|
|
7
|
+
data.tar.gz: 19182e51ecb9e089639e854a9996c8a725d98108cc81e2352753e7610749dca053b651a3e11387c1db3cc85dcef066e9343cd85ecc889de0a6ff1f8b2699c0e9
|
|
@@ -10,22 +10,23 @@ module Cinch::Plugins
|
|
|
10
10
|
|
|
11
11
|
def initialize(*args)
|
|
12
12
|
super
|
|
13
|
-
@
|
|
13
|
+
@times = Hash.new(Time.now)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def join_respond(m)
|
|
17
17
|
return if m.user.nick == @bot.nick
|
|
18
|
-
m.reply "Hello, #{m.user.nick}. The last activity was
|
|
18
|
+
m.reply "Hello, #{m.user.nick}. The last activity was "\
|
|
19
|
+
"#{time_passed(m.channel.name)} ago."
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
def update_time(m)
|
|
22
|
-
@
|
|
23
|
+
@times[m.channel.name] = Time.now
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
private
|
|
26
27
|
|
|
27
|
-
def time_passed
|
|
28
|
-
Cinch::Toolbox.time_format(Time.now - @
|
|
28
|
+
def time_passed(channel)
|
|
29
|
+
Cinch::Toolbox.time_format(Time.now - @times[channel])
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
32
|
end
|