slack-smart-bot 0.8.0 → 0.8.1

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: e67d5995df02ee254fa8718239824db71089ea64978f9faecdcca2314ebf9a65
4
- data.tar.gz: 057437a83aaf967520f7cb327c0225f2a2bd2194c5a97502131869f537484d81
3
+ metadata.gz: 70b7af756d9c6656b126ae88c346af4616e92c4515038eb0008fdcfc401c6c27
4
+ data.tar.gz: 20f8742c519cccf4c4799a82fc189acfe871e6a4070dc39fe02ac8dbd6584fdf
5
5
  SHA512:
6
- metadata.gz: 9415c8a44f98beafdc03ab06df88064ac7ac83d16de3fd3b1f5c3033937e0956c30db54d74272e867b33e2d9f99e60ea33165ed8ec89a8d3923c95c7e2a829bb
7
- data.tar.gz: b2d54101b89ecc4a9d048313674d99b0269d40e520f709f24a189f3d490c74c8a8e8ae5b506308e4022daf8d65a3fee79dbd8dccb4652c36a2cd4643a70f8987
6
+ metadata.gz: d7151651fc746c7937b7fff54566819ba43cb41af4be90dd65ff650fed626768c40bcc342ded36e0d0435fecf83acce5977b66fd0b290a98f586e216787dc72e
7
+ data.tar.gz: eac2850e304e92a876ef0d6ebca07f086ec80758d951dcf980a11323ffbf77b0c5ee02ba0696582a0b9ba46c68f7704b2efcfff37f6c972d24bc47449571798e
@@ -145,6 +145,9 @@ class SlackSmartBot
145
145
  @bots_created = eval(file_conf)
146
146
  end
147
147
  @datetime_bots_created = File.mtime($0.gsub(".rb", "_bots.rb"))
148
+ @bots_created.each do |k,v| # to be compatible with old versions
149
+ v[:extended] = [] unless v.key?(:extended)
150
+ end
148
151
  end
149
152
  end
150
153
 
@@ -1227,6 +1230,8 @@ class SlackSmartBot
1227
1230
  end
1228
1231
 
1229
1232
  #to send a file to an user or channel
1233
+ #send_file(dest, 'the message', "#{project_folder}/temp/logs_ptBI.log", 'message to be sent', 'text/plain', "text")
1234
+ #send_file(dest, 'the message', "#{project_folder}/temp/example.jpeg", 'message to be sent', 'image/jpeg', "jpg")
1230
1235
  def send_file(to, msg, file, title, format, type = "text")
1231
1236
  if to[0] == "U" #user
1232
1237
  im = client.web_client.im_open(user: to)
@@ -105,10 +105,18 @@ def rules(user, command, processed, dest)
105
105
  else
106
106
  respond "#{user.name}: #{stderr}", dest
107
107
  end
108
+
109
+ # Examples sending a file to slack:
110
+ # send_file(to, msg, filepath, title, format, type = "text")
111
+ # send_file(dest, 'the message', "#{project_folder}/temp/logs_ptBI.log", 'message to be sent', 'text/plain', "text")
112
+ # send_file(dest, 'the message', "#{project_folder}/temp/example.jpeg", 'message to be sent', 'image/jpeg', "jpg")
113
+
108
114
  else
109
115
  unless processed
110
- resp = %w{ what huh sorry }.sample
111
- respond "#{firstname}: #{resp}?", dest
116
+ if CHANNEL == dest or dest[0]=="D" or dest[0] == "G" #not on extended channels
117
+ resp = %w{ what huh sorry }.sample
118
+ respond "#{firstname}: #{resp}?", dest
119
+ end
112
120
  end
113
121
  end
114
122
  rescue => exception
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: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Ruiz