lita-irc 2.0.3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/lib/lita/adapters/irc/cinch_plugin.rb +9 -0
- data/lita-irc.gemspec +1 -1
- data/spec/lita/adapters/irc/cinch_plugin_spec.rb +17 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1dda3d72d7f84dbdca6634ffe3c0a7f81f921b7
|
4
|
+
data.tar.gz: 19412c2a25b7f5ad4e2425deba288befe116aed5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d762ba6efad744c31edbd794cb754e3d428169e7f2819cce642fc6832d7c6c6d85e8d2a62c34d123050e621d31d5d22a67da1d6acf9dd2dd3245e08f7249768
|
7
|
+
data.tar.gz: 41add8b7a2cfd4c0f8ee4a90fdbd196c54d9c4fd64da644053ff6de4f59608fd5337838c648f0aee1e9ef5e9377455f08f8bc0d5c7e3cef80183431fc8854573
|
data/README.md
CHANGED
@@ -58,7 +58,13 @@ end
|
|
58
58
|
|
59
59
|
## Events
|
60
60
|
|
61
|
-
The IRC adapter will trigger
|
61
|
+
The IRC adapter will trigger these events:
|
62
|
+
|
63
|
+
| Event | When | Payload |
|
64
|
+
|------------------------|---------------------------|----------------------------------------|
|
65
|
+
| `:connected` | connected to IRC | None |
|
66
|
+
| `:disconnected` | disconnected from IRC | None |
|
67
|
+
| `:user_joined_room` | a user joins a room | `user: Lita::User`, `room: Lita::Room` |
|
62
68
|
|
63
69
|
## License
|
64
70
|
|
@@ -9,6 +9,7 @@ module Lita
|
|
9
9
|
match /.*/
|
10
10
|
listen_to :connect, method: :on_connect
|
11
11
|
listen_to :invite, method: :on_invite
|
12
|
+
listen_to :join, method: :on_room_join
|
12
13
|
|
13
14
|
def execute(m)
|
14
15
|
body = get_body(m)
|
@@ -27,6 +28,14 @@ module Lita
|
|
27
28
|
m.channel.join if robot.auth.user_is_admin?(user)
|
28
29
|
end
|
29
30
|
|
31
|
+
def on_room_join(m)
|
32
|
+
robot.trigger(
|
33
|
+
:user_joined_room,
|
34
|
+
user: user_by_nick(m.user.nick),
|
35
|
+
room: Lita::Room.create_or_update(m.channel.name, name: m.channel.name),
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
30
39
|
private
|
31
40
|
|
32
41
|
def dispatch(message)
|
data/lita-irc.gemspec
CHANGED
@@ -9,6 +9,7 @@ describe Lita::Adapters::IRC::CinchPlugin do
|
|
9
9
|
let(:user) { double("Lita::User", name: "Carl") }
|
10
10
|
let(:message) { double("Lita::Message", command!: nil, source: source) }
|
11
11
|
let(:source) { double("Lita::Source", room: "#channel", user: user) }
|
12
|
+
let(:room) { double("Lita::Room", name: "#channel") }
|
12
13
|
let(:m) do
|
13
14
|
instance_double(
|
14
15
|
"Cinch::Message",
|
@@ -81,4 +82,20 @@ describe Lita::Adapters::IRC::CinchPlugin do
|
|
81
82
|
subject.on_invite(invite_m)
|
82
83
|
end
|
83
84
|
end
|
85
|
+
|
86
|
+
describe "#on_room_join" do
|
87
|
+
before do
|
88
|
+
allow(Lita::Room).to receive(:create_or_update).and_return(room)
|
89
|
+
allow(Lita::User).to receive(:find_by_name).and_return(user)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "triggers a join event when someone joins a channel" do
|
93
|
+
expect(robot).to receive(:trigger).with(
|
94
|
+
:user_joined_room,
|
95
|
+
user: user,
|
96
|
+
room: room,
|
97
|
+
)
|
98
|
+
subject.on_room_join(m)
|
99
|
+
end
|
100
|
+
end
|
84
101
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-irc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Cuadra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.5.2
|
153
153
|
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: An IRC adapter for the Lita chat robot.
|