slack-smart-bot 0.3.0 → 0.3.5

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/slack-smart-bot.rb +22 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfe8bd620d33775142c024063dd587fa8dfae7bb42c998fc617cf7d75daa991a
4
- data.tar.gz: cc0829d5ebe5085c54b3f87f7c43c07718e8a0c05415acf49f1dea2c8ff0ca27
3
+ metadata.gz: 65273faf13f558bd860870ec2a8161391735dae7f7b9aeaba8a3cf579a29e11c
4
+ data.tar.gz: ace62d78127a15e7faa8c84e0d25df8ce1a0e79a1fbd1985950fe1642330aeb9
5
5
  SHA512:
6
- metadata.gz: d4381cba75e222058b4ba20c29c9ae2e3caaaa7db0a839645f7109b1e74c6c61da401fc7ae3b9df3fa016fc4624b7e24dfe5f543b76cdff56fdc0b18a86565a0
7
- data.tar.gz: 62445d54652b4b4fa3ce9155d0736c812be8a31133b4b2def6cadb66f30f78834c1ae7c6a08cd37cea239914d3d7e10932550ed608fa2e3954f5e8d00448196f
6
+ metadata.gz: bda8ad2a8a6ef3cf7a849d120249d486aad988141b6a71ec52d34617b254c8da4bbe5c15e27733d42463a6c6f142285886b2c63975930d29b1c9c42f5391e924
7
+ data.tar.gz: c4e09cca74187a717a14500e3a311c63d99c3c1458bfd559a8cf80eab5cb4a46ac7c555b5a4ce10f4f3c337ebf0453b97ba066664b5c6e04ee74ed5710150c55
@@ -285,7 +285,7 @@ class SlackSmartBot
285
285
  else #jal9
286
286
  @logger.info "it is a direct message with no rules file selected so no rules file executed."
287
287
  unless processed
288
- resp = %w{ what huh sorry }.sample
288
+ resp = ['what', 'huh', 'sorry', 'what do you mean', "I don't understand"].sample
289
289
  respond "#{resp}?", id_user
290
290
  end
291
291
  end
@@ -661,7 +661,7 @@ class SlackSmartBot
661
661
  respond help_message_rules.scan(/#\s*help\s*:(.*)/).join("\n"), id_user
662
662
  end
663
663
  end
664
- respond "Github project: https://github.com/MarioRuiz/slack-smart-bot", id_user
664
+ respond "Github project: https://github.com/MarioRuiz/slack-smart-bot", id_user if !specific
665
665
  else
666
666
  processed = false
667
667
  end
@@ -889,6 +889,26 @@ class SlackSmartBot
889
889
  client.message(channel: im["channel"]["id"], as_user: true, text: msg)
890
890
  end
891
891
  end
892
+
893
+ #to send a file to an user or channel
894
+ def send_file(to, msg, file, title, format)
895
+ if to[0]=="U" #user
896
+ im = wclient.im_open(user: to)
897
+ channel = im["channel"]["id"]
898
+ else
899
+ channel = to
900
+ end
901
+
902
+ wclient.files_upload(
903
+ channels: channel,
904
+ as_user: true,
905
+ file: Faraday::UploadIO.new(file, format),
906
+ title: title,
907
+ filename: file,
908
+ initial_comment: msg
909
+ )
910
+
911
+ end
892
912
 
893
913
  private :update_bots_file, :get_channels_name_and_id, :update_shortcuts_file
894
914
  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: 0.3.0
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Ruiz