slack-smart-bot 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/slack-smart-bot.rb +7 -7
- data/lib/slack-smart-bot_rules.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46bf9787eb4c8793c05d6bb1fe2048700c34d8aa9115db23c6ceb16f1807db3d
|
4
|
+
data.tar.gz: 29d6b1c59d773a336e547946f7e7df2f07b3e00c6cb4587840903978bcd4b481
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 073b8fcaa53dfc9065f7e9fb9bd135dfed9b165ed108a2cd6cab708a79225e7176b03f8772ca3bbcf1e1bef149095efef706910b2db73326a317aa7c6d26a17c
|
7
|
+
data.tar.gz: 9ef5b5452f3a12ca1cf5b3975359e900047c8e95399152b19e81d0824c015998cf71176e6b9eacacefd51bd7756009dc4875e8b0e45938274d606961f06f519f
|
data/README.md
CHANGED
data/lib/slack-smart-bot.rb
CHANGED
@@ -284,7 +284,7 @@ class SlackSmartBot
|
|
284
284
|
else
|
285
285
|
@logger.warn "It seems like rules method is not defined"
|
286
286
|
end
|
287
|
-
else
|
287
|
+
else
|
288
288
|
@logger.info "it is a direct message with no rules file selected so no rules file executed."
|
289
289
|
unless processed
|
290
290
|
resp = ["what", "huh", "sorry", "what do you mean", "I don't understand"].sample
|
@@ -301,7 +301,7 @@ class SlackSmartBot
|
|
301
301
|
end
|
302
302
|
end
|
303
303
|
|
304
|
-
#help:
|
304
|
+
#help: ===================================
|
305
305
|
#help:
|
306
306
|
#help: *General commands:*
|
307
307
|
#help:
|
@@ -443,7 +443,7 @@ class SlackSmartBot
|
|
443
443
|
#helpmaster: creates a new bot on the channel specified
|
444
444
|
#helpmaster: it will work only if you are on Master channel
|
445
445
|
#helpmaster:
|
446
|
-
when /^create\sbot\son\s<#C\w+\|(.+)>\s*/i, /^create\sbot\son\s(.+)\s*/i
|
446
|
+
when /^create\sbot\son\s<#C\w+\|(.+)>\s*/i, /^create\sbot\son\s(.+)\s*/i
|
447
447
|
if ON_MASTER_BOT
|
448
448
|
channel = $1
|
449
449
|
|
@@ -462,7 +462,7 @@ class SlackSmartBot
|
|
462
462
|
respond "There is no channel with that name: #{channel}, please be sure is written exactly the same", id_user
|
463
463
|
elsif channel == MASTER_CHANNEL
|
464
464
|
respond "There is already a bot in this channel: #{channel}", id_user
|
465
|
-
elsif @bots_created.keys.include?(channel_id)
|
465
|
+
elsif @bots_created.keys.include?(channel_id)
|
466
466
|
respond "There is already a bot in this channel: #{channel}, kill it before", id_user
|
467
467
|
elsif config[:nick_id] != channel_found.creator and !channel_found.members.include?(config[:nick_id])
|
468
468
|
respond "You need to add first to the channel the smart bot user: #{config[:nick]}, kill it before", id_user
|
@@ -678,7 +678,7 @@ class SlackSmartBot
|
|
678
678
|
processed = false
|
679
679
|
end
|
680
680
|
|
681
|
-
on_demand = false
|
681
|
+
on_demand = false
|
682
682
|
if command.match(/^@?(#{config[:nick]}):*\s+(.+)$/i) or
|
683
683
|
command.match(/^()!(.+)$/i) or
|
684
684
|
command.match(/^()<@#{config[:nick_id]}>\s+(.+)$/i)
|
@@ -693,9 +693,9 @@ class SlackSmartBot
|
|
693
693
|
!id_user.nil? or on_demand)
|
694
694
|
processed2 = true
|
695
695
|
|
696
|
-
#help:
|
696
|
+
#help: ===================================
|
697
697
|
#help:
|
698
|
-
#help: *These commands will run only when the smart bot is listening to you or on demand or in a private conversation with the Smart Bot*.
|
698
|
+
#help: *These commands will run only when the smart bot is listening to you or on demand or in a private conversation with the Smart Bot*. To run a command on demand:
|
699
699
|
#help: `!THE_COMMAND`
|
700
700
|
#help: `@NAME_OF_BOT THE_COMMAND`
|
701
701
|
#help: `NAME_OF_BOT THE_COMMAND`
|
@@ -20,12 +20,12 @@ end
|
|
20
20
|
# from: Full name of the person sending the message
|
21
21
|
# command: command to run
|
22
22
|
# processed: in case the command has been already processed on Bot class, by default false
|
23
|
-
# help:
|
23
|
+
# help: ===================================
|
24
24
|
# help:
|
25
25
|
# help: *These are specific commands for this bot on this Channel.*
|
26
26
|
# help: They will be accessible only when the bot is listening to you just writing the command
|
27
27
|
# help: or the bot is not listening to you but requested on demand, or in a private conversation with the Smart Bot.
|
28
|
-
# help:
|
28
|
+
# help: To run a command on demand:
|
29
29
|
# help: `!THE_COMMAND`
|
30
30
|
# help: `@NAME_OF_BOT THE_COMMAND`
|
31
31
|
# help: `NAME_OF_BOT THE_COMMAND`
|
@@ -60,6 +60,7 @@ def rules(user, command, processed, id_user)
|
|
60
60
|
else
|
61
61
|
case @questions[from]
|
62
62
|
when /yes/i, /yep/i, /sure/i
|
63
|
+
@questions.delete(from)
|
63
64
|
respond "zZzzzzzZZZZZZzzzzzzz!", id_user
|
64
65
|
respond "I'll be sleeping for 5 secs... just for you", id_user
|
65
66
|
sleep 5
|
@@ -81,6 +82,9 @@ end
|
|
81
82
|
|
82
83
|
#for the case of testing just running this file, write the dialogue in here:
|
83
84
|
if @testing
|
84
|
-
|
85
|
-
|
85
|
+
require 'nice_hash'
|
86
|
+
user = {name: "Peter Johson", id: "Uxxxxxx"}
|
87
|
+
|
88
|
+
rules user, "go to sleep, you look tired", false, nil
|
89
|
+
rules user, "yes", false, nil
|
86
90
|
end
|
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.4.
|
4
|
+
version: 0.4.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-05-
|
11
|
+
date: 2019-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slack-ruby-client
|