slack-smart-bot 1.6.7 → 1.6.8
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8beec65b75d11296e5004d8d365e85e4ae7c8ebc8c8d4dffd913a723b3094c1
|
4
|
+
data.tar.gz: af507d5d01eae40db5001227f375d3c6e46b0e45ab448f81b390dad4af9d046a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b32a7967366c7ff3a3e9036a458173063c646bc0e4414fd8920fd0c34f2b70efa612a56aca9638101462fd294b909fe350d162c899eb08ae847fb25f47d217b
|
7
|
+
data.tar.gz: e8cc5c61049baf6c99832b7158807f7b0b0249df829ca41fd93ed68d9796b5da914df00223610a3828bd35542c172b9e3629f32f32ab77aee99c1acdd0ffbccc
|
@@ -3,8 +3,11 @@ class SlackSmartBot
|
|
3
3
|
#to send a file to an user or channel
|
4
4
|
#send_file(dest, 'the message', "#{project_folder}/temp/logs_ptBI.log", 'message to be sent', 'text/plain', "text")
|
5
5
|
#send_file(dest, 'the message', "#{project_folder}/temp/example.jpeg", 'message to be sent', 'image/jpeg', "jpg")
|
6
|
-
|
6
|
+
#send_file(dest, 'the message', "", 'message to be sent', 'text/plain', "ruby", content: "the content to be sent when no file supplied")
|
7
|
+
#send_file(dest, 'the message', "myfile.rb", 'message to be sent', 'text/plain', "ruby", content: "the content to be sent when no file supplied")
|
8
|
+
def send_file(to, msg, file, title, format, type = "text", content: '')
|
7
9
|
unless config[:simulate]
|
10
|
+
file = 'myfile' if file.to_s == '' and content!=''
|
8
11
|
if to[0] == "U" #user
|
9
12
|
im = client.web_client.im_open(user: to)
|
10
13
|
channel = im["channel"]["id"]
|
@@ -18,16 +21,29 @@ class SlackSmartBot
|
|
18
21
|
ts = nil
|
19
22
|
end
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
if content.to_s == ''
|
25
|
+
client.web_client.files_upload(
|
26
|
+
channels: channel,
|
27
|
+
as_user: true,
|
28
|
+
file: Faraday::UploadIO.new(file, format),
|
29
|
+
title: title,
|
30
|
+
filename: file,
|
31
|
+
filetype: type,
|
32
|
+
initial_comment: msg,
|
33
|
+
thread_ts: ts
|
34
|
+
)
|
35
|
+
else
|
36
|
+
client.web_client.files_upload(
|
37
|
+
channels: channel,
|
38
|
+
as_user: true,
|
39
|
+
content: content,
|
40
|
+
title: title,
|
41
|
+
filename: file,
|
42
|
+
filetype: type,
|
43
|
+
initial_comment: msg,
|
44
|
+
thread_ts: ts
|
45
|
+
)
|
46
|
+
end
|
31
47
|
end
|
32
48
|
end
|
33
49
|
|
@@ -198,7 +198,13 @@ class SlackSmartBot
|
|
198
198
|
sleep 0.2
|
199
199
|
resp_repl = file_output_repl.read
|
200
200
|
if resp_repl.to_s!=''
|
201
|
-
|
201
|
+
if resp_repl.to_s.lines.count < 60
|
202
|
+
respond resp_repl, dest
|
203
|
+
else
|
204
|
+
resp_repl.gsub!(/^```/,'')
|
205
|
+
resp_repl.gsub!(/```$/,'')
|
206
|
+
send_file(dest, "", 'response.rb', "", 'text/plain', "ruby", content: resp_repl)
|
207
|
+
end
|
202
208
|
end
|
203
209
|
rescue Exception => excp
|
204
210
|
@logger.fatal excp
|
@@ -15,7 +15,7 @@ class SlackSmartBot
|
|
15
15
|
message = ""
|
16
16
|
@repls.sort.to_h.each do |session_name, repl|
|
17
17
|
if (repl.creator_name == user.name or repl.type == :public) or (config.admins.include?(user.name) and typem == :on_dm)
|
18
|
-
message += "(#{repl.type}) *#{session_name}*: #{repl.description} / created: #{repl.created} / accessed: #{repl.accessed} / creator:
|
18
|
+
message += "(#{repl.type}) *#{session_name}*: #{repl.description} / created: #{repl.created} / accessed: #{repl.accessed} / creator: #{repl.creator_name} / runs: #{repl.runs_by_creator+repl.runs_by_others} / gets: #{repl.gets} \n"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
message = "No repls created" if message == ''
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-smart-bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slack-ruby-client
|