slack-smart-bot 0.3.0 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slack-smart-bot.rb +22 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65273faf13f558bd860870ec2a8161391735dae7f7b9aeaba8a3cf579a29e11c
|
4
|
+
data.tar.gz: ace62d78127a15e7faa8c84e0d25df8ce1a0e79a1fbd1985950fe1642330aeb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bda8ad2a8a6ef3cf7a849d120249d486aad988141b6a71ec52d34617b254c8da4bbe5c15e27733d42463a6c6f142285886b2c63975930d29b1c9c42f5391e924
|
7
|
+
data.tar.gz: c4e09cca74187a717a14500e3a311c63d99c3c1458bfd559a8cf80eab5cb4a46ac7c555b5a4ce10f4f3c337ebf0453b97ba066664b5c6e04ee74ed5710150c55
|
data/lib/slack-smart-bot.rb
CHANGED
@@ -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 =
|
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
|