slackbotsy 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slackbotsy/bot.rb +2 -0
- data/lib/slackbotsy/message.rb +9 -2
- data/lib/slackbotsy/version.rb +1 -1
- 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: 1541278505c1973d7a12af39d7c44be6d95aa6ad
|
4
|
+
data.tar.gz: a21fdba46ea03e1c9ade798b1ff3e183c13b0180
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bbf5210fc9324df30100423fc4924bd0f1eaf8e60a7814048512c0b9776958a91ad7e971a5f3dada0f7933e82e0c0abd2d3eb11b6df0f9b75a984d3607507a0
|
7
|
+
data.tar.gz: 59dc50d47fb889236cda224cef7bb575bf26c797bb52118c6bbc9d4cabedf2ebc3d0585abf08e2cbd8add0def7455947588f6aa6572700a696f9405cf0a18686
|
data/lib/slackbotsy/bot.rb
CHANGED
@@ -75,6 +75,7 @@ module Slackbotsy
|
|
75
75
|
payload[:channel] = payload[:channel].gsub(/^#?/, '#') # chat.postMessage needs leading # on channel
|
76
76
|
@api.join(payload[:channel])
|
77
77
|
@api.post_message(payload)
|
78
|
+
return nil # be quiet in webhook reply
|
78
79
|
end
|
79
80
|
|
80
81
|
## simple wrapper on api.upload (which calls files.upload)
|
@@ -86,6 +87,7 @@ module Slackbotsy
|
|
86
87
|
channels.find { |c| name.match(/^#?#{c['name']}$/) }.fetch('id') # convert channel id to name
|
87
88
|
end.join(',')
|
88
89
|
@api.upload(payload)
|
90
|
+
return nil # be quiet in webhook reply
|
89
91
|
end
|
90
92
|
|
91
93
|
## record a description of the next hear block, for use in help
|
data/lib/slackbotsy/message.rb
CHANGED
@@ -8,6 +8,7 @@ module Slackbotsy
|
|
8
8
|
super()
|
9
9
|
self.update(msg)
|
10
10
|
@caller = caller # bot object
|
11
|
+
@bot = caller # alias for bot object
|
11
12
|
end
|
12
13
|
|
13
14
|
## convenience wrapper in message scope, so we can call it without @caller
|
@@ -16,16 +17,22 @@ module Slackbotsy
|
|
16
17
|
@caller.post({ channel: self['channel_name'] }.merge(options))
|
17
18
|
end
|
18
19
|
|
19
|
-
## ditto
|
20
20
|
def say(text, options = {})
|
21
21
|
@caller.say(text, { channel: self['channel_name'] }.merge(options))
|
22
22
|
end
|
23
23
|
|
24
|
-
## ditto
|
25
24
|
def attach(attachments, options = {})
|
26
25
|
@caller.attach(attachments, { channel: self['channel_name'] }.merge(options))
|
27
26
|
end
|
28
27
|
|
28
|
+
def post_message(text, options = {})
|
29
|
+
@caller.post_message(text, { channel: self['channel_name'] }.merge(options))
|
30
|
+
end
|
31
|
+
|
32
|
+
def upload(options = {})
|
33
|
+
@caller.upload({ channel: self['channel_name'] }.merge(options))
|
34
|
+
end
|
35
|
+
|
29
36
|
## convenience getter methods for message properties
|
30
37
|
%w[ token team_id channel_id channel_name timestamp user_id user_name text ].each do |method|
|
31
38
|
define_method(method) do
|
data/lib/slackbotsy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slackbotsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Lister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.4.5
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Ruby bot for Slack chat.
|