slack-smart-bot 1.6.3 → 1.6.4

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: ecb1da7d24358beb4544377c625a0d72bedf3e77b4d7be0596edba30d44ca945
4
- data.tar.gz: a8974bc95a2404e62425b4f39ed38e2db896558ca42c1de5f1dbc5fada453dc0
3
+ metadata.gz: f07b09cbcf1e3546a38bf8f34ac6eff1d3e19c53af22cc38663b1cf932da7440
4
+ data.tar.gz: '05639afadac3c32459fed0999db003d162fa1d61db6e89e085acab95c4f76f1b'
5
5
  SHA512:
6
- metadata.gz: f315a12bd2b523f9fb08081a39529994af2159c015d2d711f836ac55d83585fe3fcb0002bbbfd2e975a0ed3bd87908249edd2333fbcfe84638f62e109e3dd2bb
7
- data.tar.gz: d4158da3cd73c87813f0fa0c72b849db557b99fe854cdd8258c35bd2a2861e7f981285a75890587427ab05923cffaa8f6c2effac2c3ed6fff5acb4aac633015a
6
+ metadata.gz: bb067ed25c1cf464cb104ba56e3ff995366fc72e5f657dafd99e942092616a9bda58f33bd6f52f8c1b8db37a5f2d0e79a12fed3acf0a2d0f52e795e82fd9b1c1
7
+ data.tar.gz: f2db5a51c5f74c791c8793efbaf68626c2444ba2b7d6aabdd8485723d9b25bb4a43b0db2fa9d11d788091a011e22ceb2d40c6ee985daa28f4ba26a8e2c47e14b
@@ -20,6 +20,7 @@ class SlackSmartBot
20
20
  @repls.delete(session_name)
21
21
  update_repls()
22
22
  File.rename("#{config.path}/repl/#{@channel_id}/#{session_name}.input", "#{config.path}/repl/#{@channel_id}/#{session_name}_#{Time.now.strftime("%Y%m%d%H%M%S%N")}.deleted")
23
+ File.delete("#{config.path}/repl/#{@channel_id}/#{session_name}.run") if File.exist?("#{config.path}/repl/#{@channel_id}/#{session_name}.run")
23
24
  respond "REPL #{session_name} deleted"
24
25
  else
25
26
  respond "Only admins or the creator of this REPL can delete it", dest
@@ -126,14 +126,29 @@ class SlackSmartBot
126
126
  elsif @repl_sessions.key?(user_info.user.name) and dest==@repl_sessions[user_info.user.name][:dest] and
127
127
  ((@repl_sessions[user_info.user.name][:on_thread] and data.thread_ts == @repl_sessions[user_info.user.name][:thread_ts]) or
128
128
  (!@repl_sessions[user_info.user.name][:on_thread] and data.thread_ts.to_s == '' ))
129
- @repl_sessions[user_info.user.name][:command] = data.text
129
+
130
+ if data.text.size >= 6 and data.text[0..2] == "```" and data.text[-3..-1] == "```"
131
+ if data.text.size == 6
132
+ @repl_sessions[user_info.user.name][:command] = ""
133
+ else
134
+ @repl_sessions[user_info.user.name][:command] = data.text[3..-4]
135
+ end
136
+ else
137
+ @repl_sessions[user_info.user.name][:command] = data.text
138
+ end
130
139
  command = 'repl'
131
140
  else
132
141
  command = data.text
133
142
  end
134
143
 
135
144
  #when added special characters on the message
136
- if command.size >= 2 and
145
+ if command.size >= 6 and command[0..2]=="```" and command[-3..-1]=="```"
146
+ if command.size == 6
147
+ command = ''
148
+ else
149
+ command = command[3..-4]
150
+ end
151
+ elsif command.size >= 2 and
137
152
  ((command[0] == "`" and command[-1] == "`") or (command[0] == "*" and command[-1] == "*") or (command[0] == "_" and command[-1] == "_"))
138
153
  command = command[1..-2]
139
154
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-smart-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Ruiz