lita-ambush 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aae89189322cc97c87fa2264ae4be004da5c75c7
4
- data.tar.gz: cfc777349ea31853e7ec3a417bf2698343c7a5a8
3
+ metadata.gz: af3371a96facf426835ac88e6a5c0f90c284e3ff
4
+ data.tar.gz: d84efbd5234e19f5fe24e365b40a1c22227f38fe
5
5
  SHA512:
6
- metadata.gz: be1cee30fbc133d4aab87ba74055068f5d971669b388efa090ef5c6bc5cca22d6d6642af398d80636a53b151fe14156ae4cc7efcad63fe13c059537aee9e3697
7
- data.tar.gz: 72c53bfd7959f7c76e63b8cbc2d5c9b7450f7767571b349eaf026fa6d5b39993bc83bd2aa98a0722dcc8605ee9832761aadad1fb9c85ed12b66ec70fa93bc53b
6
+ metadata.gz: b4a3a2ae1fdd58dcfe7a4dc7c2683214233f2bd6f0669f623c7b25bb57afb2fde23efc2d433fb37fe3556d50df9aa3dfb52f2ec0df040dcd8c7c7340624f4388
7
+ data.tar.gz: 6fadaefbcb8593f38270a832a2b5c47746127bc6794713c65b605f9e505f771a5a311ae2c0834716cf905d8aaeef67bf10ec8b04c70d46d9a2430b2ba8fb97e0
data/README.md CHANGED
@@ -7,6 +7,11 @@ them the next time they say something.
7
7
 
8
8
  We also recorded the three of us making this plugin. You can watch it [here](http://youtu.be/mQ6ULfjewE0).
9
9
 
10
+ ## Supported Chat systems
11
+
12
+ - IRC
13
+ - [Hipchat](http://i.imgur.com/6ekGWNG.png)
14
+
10
15
  ## Installation
11
16
 
12
17
  Add lita-ambush to your Lita instance's Gemfile:
@@ -30,29 +35,6 @@ user2> That was a great lunch!
30
35
  Lita> user2: while you were out, user1 said: Ohai! You forgot your card at lunch!
31
36
  ```
32
37
 
33
- ## TODO
34
-
35
- - Have the plugin tell the time elapsed since the ambush was created, example:
36
- `user2: while you were out, user1 said: Ohai! You forgot your card at lunch! was sent 10 minutes ago`
37
-
38
- - Have the plugin report the number of waiting messages you have when a `JOIN` action happens, example:
39
-
40
- ```
41
- User2 joined the channel
42
- Lita> User2 you have 1 message(s) waiting
43
- ```
44
-
45
- Configuration can happen via:
46
-
47
- * `preview_join_messages` (Symbol) - Post a message for the user when they
48
- just join the room. Options are `:on`, and `:off`. Default: `:off`.
49
-
50
- ```
51
- Lita.configure do |config|
52
- config.handlers.ambush.preview_join_messages = :off
53
- end
54
- ```
55
-
56
38
  ## License
57
39
 
58
40
  [MIT](http://opensource.org/licenses/MIT)
@@ -4,26 +4,29 @@ module Lita
4
4
  module Handlers
5
5
  class Ambush < Handler
6
6
 
7
- route(/^ambush\s+(\S+):\s(.+)/, :ambush, command: true, help: { "ambush USER: message" => "Ambushes the USER with the message you leave."} )
7
+ route(/^ambush\s+(\S+):?\s*(.+)/, :ambush, command: true, help: { "ambush USER: message" => "Ambushes the USER with the message you leave."} )
8
8
  route(/./, :response)
9
9
 
10
10
  def ambush(request)
11
+ ambushee = request.matches[0][0]
12
+ ambushee = ambushee[1..-1] if ambushee.start_with? "@"
11
13
  store_hash = {
12
14
  time: Time.now.to_i,
13
15
  msg: request.matches[0][1],
14
16
  ambusher: request.user.name
15
17
  }.to_yaml
16
- redis.lpush(request.matches[0][0],store_hash)
17
- request.reply("#{request.user.name} I've stored the ambush")
18
+ log.debug(ambushee)
19
+ redis.lpush(ambushee,store_hash)
20
+ request.reply_with_mention("I've stored the ambush")
18
21
  end
19
22
 
20
23
  def response(request)
21
24
  unless request.message.body.start_with? "ambush"
22
- stored_yaml = redis.rpop(request.user.name)
25
+ stored_yaml = redis.rpop(request.user.mention_name)
23
26
  while not stored_yaml.nil? do
24
27
  outputted_yaml=YAML.load(stored_yaml)
25
- request.reply("#{request.user.name}: While you were out, #{outputted_yaml[:ambusher]} said: #{outputted_yaml[:msg]}")
26
- stored_yaml = redis.rpop(request.user.name)
28
+ request.reply_with_mention("While you were out, #{outputted_yaml[:ambusher]} said: #{outputted_yaml[:msg]}")
29
+ stored_yaml = redis.rpop(request.user.mention_name)
27
30
  end
28
31
  end
29
32
  end
data/lita-ambush.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-ambush"
3
- spec.version = "1.0.1"
3
+ spec.version = "1.0.2"
4
4
  spec.authors = ["JJ Asghar","Chris Baker","Greg Kitson"]
5
5
  spec.email = ["jjasghar@gmail.com","dosman711@gmail.com","greg.kitson@gmail.com"]
6
6
  spec.description = %q{Allow lita to ambush your users}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-ambush
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - JJ Asghar
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-03-21 00:00:00.000000000 Z
13
+ date: 2015-05-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: lita