ruboty-slack_reaction_added 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: 4122589df509c322716a0fca06d9b11cb113efe3d8700ca22066924e7f958f99
4
- data.tar.gz: 64ae8e60524c57343c6606ce8b277c32c9c125d46d941d7e982c2fb65680f92d
3
+ metadata.gz: eb850ae12f6075992b75dcaff1d1f253b94785f3ebfdbe960019585630eadcaa
4
+ data.tar.gz: 11afb399849a1fe493f51cf6cdf780f2448bc970297c8a620a2624ec8633c44a
5
5
  SHA512:
6
- metadata.gz: 40b1d855d6d5e3c55e71751bc7d259bb6dc77534a6f0fae0a1aa74df41a098355f04008bb19c517209f67af3671519bdde77faf760b271cc907cd2dc294c8414
7
- data.tar.gz: b8ae5454c3bf7656246b39a36afa2ed8e8582e6645285c64fcdeb2b0cc17971c69d82c142a928dfa64b7595c687d9f53934e90e0e49a2bdb4d8ab1ae41b6f781
6
+ metadata.gz: 92df958b3394dfc26a5be702d1a5a0245690ba4acef4c740be3a6a4c5efdd1e104aff6a31150d1b6ea9374ff38777840f001ff754123590136de189374f89591
7
+ data.tar.gz: 3892346b27043648b126e2839f83e77332deacfe852c6aa4de5c905fa1c19a7c6bf783425feb75e727abda962e456246661e3ac664698d624d80bae940b5a77c
@@ -3,6 +3,7 @@ require 'ruboty/slack_reaction_added/extension/action'
3
3
  require 'ruboty/slack_reaction_added/extension/adapter'
4
4
  require 'ruboty/slack_reaction_added/extension/client'
5
5
  require 'ruboty/slack_reaction_added/extension/message'
6
+ require 'ruboty/slack_reaction_added/extension/robot'
6
7
 
7
8
  if ENV["DISABLE_DEFAULT_REACTION_HANDLERS"] != "1"
8
9
  require 'ruboty/slack_reaction_added/handlers/handler.rb'
@@ -0,0 +1,17 @@
1
+
2
+ module Ruboty
3
+ module SlackReactionAdded
4
+ module Actions
5
+ class Permalink < Ruboty::Actions::Base
6
+
7
+ def call
8
+ case message.reaction
9
+ when 'bookmark'
10
+ message.reply(message.permalink)
11
+ end
12
+ end
13
+
14
+ end
15
+ end
16
+ end
17
+ end
@@ -71,6 +71,11 @@ module Ruboty
71
71
  resp['channel']
72
72
  end
73
73
  end
74
+
75
+ def permalink(channel_id, ts)
76
+ permalink = @client.chat_getPermalink(channel: channel_id, message_ts: ts)
77
+ permalink['permalink']
78
+ end
74
79
  end
75
80
 
76
81
  prepend ReactionAddedSlackRTM
@@ -9,8 +9,7 @@ module Ruboty
9
9
  end
10
10
 
11
11
  def permalink
12
- permalink = @client.chat_getPermalink(channel: @original[:channel]["id"], message_ts: @original[:ts])
13
- permalink['permalink']
12
+ robot.permalink(@original[:channel]["id"], @original[:ts])
14
13
  end
15
14
 
16
15
  def reaction
@@ -0,0 +1,15 @@
1
+ require 'ruboty/robot'
2
+
3
+ module Ruboty
4
+ module ReactionAddedClient
5
+ module Robot
6
+ delegate :permalink, to: :adapter
7
+
8
+ def permalink(channel_id, timestamp)
9
+ adapter.permalink(channel_id, timestamp)
10
+ end
11
+ end
12
+ end
13
+
14
+ Robot.include ReactionAddedClient::Robot
15
+ end
@@ -1,3 +1,4 @@
1
+ require 'ruboty/slack_reaction_added/actions/permalink.rb'
1
2
  require 'ruboty/slack_reaction_added/actions/reaction_ping.rb'
2
3
  require 'ruboty/slack_reaction_added/actions/thumbup.rb'
3
4
 
@@ -7,15 +8,21 @@ module Ruboty
7
8
  class Handler < Ruboty::Handlers::Base
8
9
 
9
10
  on /ping\z/,
10
- name: 'reaction_able_ping',
11
- description: 'ping allow reaction',
12
- allow_reaction: true
11
+ name: 'reaction_able_ping',
12
+ description: 'ping allow reaction',
13
+ allow_reaction: true
13
14
 
14
15
  on /.*\z/,
15
- name: 'thumbup',
16
- description: 'thumbup',
17
- reaction_only: true,
18
- all: true
16
+ name: 'thumbup',
17
+ description: 'thumbup',
18
+ reaction_only: true,
19
+ all: true
20
+
21
+ on /.*\z/,
22
+ name: 'permalink',
23
+ description: 'permalink',
24
+ reaction_only: true,
25
+ all: true
19
26
 
20
27
  def reaction_able_ping(message)
21
28
  Ruboty::SlackReactionAdded::Actions::ReactionPing.new(message).call
@@ -25,6 +32,9 @@ module Ruboty
25
32
  Ruboty::SlackReactionAdded::Actions::Thumbup.new(message).call
26
33
  end
27
34
 
35
+ def permalink(message)
36
+ Ruboty::SlackReactionAdded::Actions::Permalink.new(message).call
37
+ end
28
38
  end
29
39
  end
30
40
  end
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module SlackReactionAdded
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-slack_reaction_added
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - srz_zumix
@@ -142,12 +142,14 @@ files:
142
142
  - Rakefile
143
143
  - docker-compose.yml
144
144
  - lib/ruboty/slack_reaction_added.rb
145
+ - lib/ruboty/slack_reaction_added/actions/permalink.rb
145
146
  - lib/ruboty/slack_reaction_added/actions/reaction_ping.rb
146
147
  - lib/ruboty/slack_reaction_added/actions/thumbup.rb
147
148
  - lib/ruboty/slack_reaction_added/extension/action.rb
148
149
  - lib/ruboty/slack_reaction_added/extension/adapter.rb
149
150
  - lib/ruboty/slack_reaction_added/extension/client.rb
150
151
  - lib/ruboty/slack_reaction_added/extension/message.rb
152
+ - lib/ruboty/slack_reaction_added/extension/robot.rb
151
153
  - lib/ruboty/slack_reaction_added/handlers/handler.rb
152
154
  - lib/ruboty/slack_reaction_added/version.rb
153
155
  - ruboty-slack_reaction_added.gemspec