slack-smart-bot 0.9.0 → 0.9.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 +4 -4
- data/README.md +16 -2
- data/lib/slack-smart-bot.rb +28 -13
- metadata +4 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2722475c7547a7166a4f47ad899b89b23f40c123fc7051124c20d3475048ca9
|
4
|
+
data.tar.gz: c98ac45760450b63c7a48185abd7e3e81580991cef6bd886535c02f702bd1126
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3ee210218954d6cb8d707ae8b021c502d9d8f8d6517e86754548f55aaeeffc7e944b3d403a052c4d4e33829c7b11ad2e319e8369418b2a573c6d8382859dd71
|
7
|
+
data.tar.gz: 6619276587528d9903ae50be641c8390860c47d3a172e10efbc9d4d09b08b1db01e591e2309b3c7efff99610fbcc2bbafc3ce3598e59d3e3b08e14c2695f55e6
|
data/README.md
CHANGED
@@ -40,11 +40,25 @@ end
|
|
40
40
|
|
41
41
|
The MASTER_CHANNEL will be the channel where you will be able to create other bots and will have special treatment.
|
42
42
|
|
43
|
-
The MASTER_USERS will have full access to everything.
|
43
|
+
The MASTER_USERS will have full access to everything. You need to use the slack user name defined on https://YOUR_WORK_SPACE.slack.com/account/settings#username.
|
44
44
|
|
45
45
|
For the token remember you need to generate a token on the Slack web for the bot user.
|
46
46
|
|
47
|
-
|
47
|
+
You can get one by any of these options:
|
48
|
+
|
49
|
+
- *[Slack App. Bot Token](https://api.slack.com/slack-apps)*. (Recommended)
|
50
|
+
|
51
|
+
1) [Create a Slack App](https://api.slack.com/apps?new_app=1)
|
52
|
+
|
53
|
+
1) Add a bot user to your app. On Add features and functionality section for your app, select *Bots*. Click on *Add a Bot User*
|
54
|
+
|
55
|
+
1) On your app click on the menu on the left: *OAuth & Permissions* and click on *Install App to Workspace*.
|
56
|
+
|
57
|
+
1) Copy your *Bot User OAuth Access Token*.
|
58
|
+
|
59
|
+
|
60
|
+
- *[Legacy API Token](https://api.slack.com/custom-integrations/legacy-tokens)*.
|
61
|
+
|
48
62
|
|
49
63
|
*Remember to invite the smart bot to the channels where they will be accessible before creating the bot*
|
50
64
|
|
data/lib/slack-smart-bot.rb
CHANGED
@@ -142,16 +142,18 @@ class SlackSmartBot
|
|
142
142
|
end
|
143
143
|
|
144
144
|
def get_bots_created
|
145
|
-
if
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
v
|
145
|
+
if File.exist?($0.gsub(".rb", "_bots.rb"))
|
146
|
+
if !defined?(@datetime_bots_created) or @datetime_bots_created!=File.mtime($0.gsub(".rb", "_bots.rb"))
|
147
|
+
file_conf = IO.readlines($0.gsub(".rb", "_bots.rb")).join
|
148
|
+
if file_conf.to_s() == ""
|
149
|
+
@bots_created = {}
|
150
|
+
else
|
151
|
+
@bots_created = eval(file_conf)
|
152
|
+
end
|
153
|
+
@datetime_bots_created = File.mtime($0.gsub(".rb", "_bots.rb"))
|
154
|
+
@bots_created.each do |k,v| # to be compatible with old versions
|
155
|
+
v[:extended] = [] unless v.key?(:extended)
|
156
|
+
end
|
155
157
|
end
|
156
158
|
end
|
157
159
|
end
|
@@ -758,9 +760,22 @@ class SlackSmartBot
|
|
758
760
|
if @status == :on
|
759
761
|
respond "I'm listening to [#{@listening.join(", ")}]", dest
|
760
762
|
if ON_MASTER_BOT and ADMIN_USERS.include?(from)
|
761
|
-
|
762
|
-
|
763
|
-
|
763
|
+
|
764
|
+
@bots_created.each do |k,v|
|
765
|
+
msg = []
|
766
|
+
msg << "`#{v[:channel_name]}` (#{k}):"
|
767
|
+
msg << "\tcreator: #{v[:creator_name]}"
|
768
|
+
msg << "\tadmins: #{v[:admins]}"
|
769
|
+
msg << "\tstatus: #{v[:status]}"
|
770
|
+
msg << "\tcreated: #{v[:created]}"
|
771
|
+
msg << "\trules: #{v[:rules_file]}"
|
772
|
+
msg << "\textended: #{v[:extended]}"
|
773
|
+
msg << "\tcloud: #{v[:cloud]}"
|
774
|
+
if ON_MASTER_BOT and v.key?(:cloud) and v[:cloud]
|
775
|
+
msg << "\trunner: `ruby #{$0} \"#{v[:channel_name]}\" \"#{v[:admins]}\" \"#{v[:rules_file]}\" on&`"
|
776
|
+
end
|
777
|
+
respond msg.join("\n"), dest
|
778
|
+
end
|
764
779
|
end
|
765
780
|
end
|
766
781
|
|
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: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slack-ruby-client
|
@@ -34,22 +34,16 @@ dependencies:
|
|
34
34
|
name: async-websocket
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 0.8.0
|
40
37
|
- - "~>"
|
41
38
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
39
|
+
version: 0.8.0
|
43
40
|
type: :runtime
|
44
41
|
prerelease: false
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
46
43
|
requirements:
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 0.8.0
|
50
44
|
- - "~>"
|
51
45
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
46
|
+
version: 0.8.0
|
53
47
|
description: "Create a Slack bot that is smart and so easy to expand, create new bots
|
54
48
|
on demand, run ruby code on chat, create shortcuts... \n The main scope of this
|
55
49
|
gem is to be used internally in the company so teams can create team channels with
|