slack-smart-bot 1.14.0 → 1.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +47 -66
- data/lib/slack/smart-bot/commands/general/bot_help.rb +1 -0
- data/lib/slack/smart-bot/commands/general_bot_commands.rb +5 -0
- data/lib/slack/smart-bot/commands/on_bot/add_shortcut.rb +2 -0
- data/lib/slack/smart-bot/commands/on_bot/admin/add_routine.rb +1 -0
- data/lib/slack/smart-bot/commands/on_bot/delete_shortcut.rb +2 -2
- data/lib/slack/smart-bot/commands/on_bot/repl.rb +1 -0
- data/lib/slack/smart-bot/commands/on_extended/bot_rules.rb +1 -0
- data/whats_new.txt +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bab245674cac897b9bc248f749a80b8d83c0654bb8abdaa1ca985211995df834
|
4
|
+
data.tar.gz: c22b08d76ee508e7f7a1f5a5a294722ff0cf10e5ddb7a88fdcfca2ac05489510
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d89f157f6e1cc1ebe762eef538b427c33610d18aeb47a0383cf17e8a18c18f7498a523bef74b4a1b8e61b455e60407fe5169ecafb0810aec813011c1b4d63f6c
|
7
|
+
data.tar.gz: 3d3eeab66e48f7289bb9dc194e38f943d95a57447419f6db66afcdea22c24d23c1f6cc9a5b391290c60f35642520e88b6110fcb2a72efdcf4188a9900ceadc92
|
data/README.md
CHANGED
@@ -231,28 +231,16 @@ To run a command on demand and add the response on a thread:
|
|
231
231
|
**_`^THE_COMMAND`_**
|
232
232
|
**_`!!THE_COMMAND`_**
|
233
233
|
|
234
|
-
Examples run a command on demand:
|
235
|
-
>**_Peter>_** `!ruby puts Time.now`
|
236
|
-
>**_Smart-Bot>_** `2019-10-23 12:43:42 +0000`
|
234
|
+
Examples run a command on demand:
|
237
235
|
|
238
|
-
|
239
|
-
>**_Smart-Bot>_** `Example`
|
236
|
+
<img src="img/commands_on_demand.png" width="500">
|
240
237
|
|
241
|
-
>**_Peter>_** `smart-bot see shortcuts`
|
242
|
-
>**_Smart-Bot>_** `Available shortcuts for Peter:`
|
243
|
-
>`Spanish account: ruby require 'iso/iban'; 10.times {puts ISO::IBAN.random('ES')}`
|
244
|
-
>**_Peter>_** `!!echo Example`
|
245
|
-
>. . . . . . . . .**_Smart-Bot>_** `Example`
|
246
|
-
>**_Peter>_** `^echo Example`
|
247
|
-
>. . . . . . . . .**_Smart-Bot>_** `Example`
|
248
238
|
|
249
239
|
Also you can always call the Smart Bot from any channel, even from channels without a running Smart Bot. You can use the External Call on Demand: **_`@NAME_OF_BOT on #CHANNEL_NAME COMMAND`_**. In this case you will call the bot on #CHANNEL_NAME. You can supply more than one channel then all the bots will respond. In case you are in a private conversation with the Smart Bot (DM) then you can use directly: **_`#CHANNEL_NAME COMMAND`_** or **_`on #CHANNEL_NAME COMMAND`_**
|
250
240
|
|
251
|
-
Examples:
|
252
|
-
|
253
|
-
|
254
|
-
>**_Peter>_** `@smart-bot on #the_channel ^ruby puts Time.now`
|
255
|
-
>. . . . . . . . .**_Smart-Bot>_** `2019-10-23 12:43:42 +0000`
|
241
|
+
Examples:
|
242
|
+
|
243
|
+
<img src="img/commands_on_external_call.png" width="400">
|
256
244
|
|
257
245
|
Examples on DM:
|
258
246
|
>**_Peter>_** `#sales show report from India`
|
@@ -260,14 +248,8 @@ Examples on DM:
|
|
260
248
|
|
261
249
|
If you want the Smart Bot just listen to part of the message you send, add the commands you want using '`' and start the line with '-!', '-!!' or '-^'
|
262
250
|
|
263
|
-
Examples:
|
264
|
-
|
265
|
-
>**_Smart-Bot>_** `a`
|
266
|
-
>**_Smart-Bot>_** `b`
|
267
|
-
|
268
|
-
>**_Peter>_** ``-^This text won't be treated but this one yes `ruby puts 'a'` and also this one `ruby puts 'b'` ``
|
269
|
-
>. . . . . . . . .**_Smart-Bot>_** `a`
|
270
|
-
>. . . . . . . . .**_Smart-Bot>_** `b`
|
251
|
+
Examples:
|
252
|
+
<img src="img/commands_inline.png" width="500">
|
271
253
|
|
272
254
|
|
273
255
|
All the commands specified on `./rules/general_commands.rb` will be accessible from any channel where the Smart Bot is present, without the necessity to call it with !, !!, ^ or on demand.
|
@@ -287,10 +269,9 @@ To show only the specific rules of the Smart Bot defined on the rules file: **_`
|
|
287
269
|
|
288
270
|
Also you can call `suggest command` or `random command` and SmartBot will return the help content for a random command.
|
289
271
|
|
290
|
-
Example:
|
291
|
-
|
292
|
-
|
293
|
-
`repeats SOMETHING`
|
272
|
+
Example:
|
273
|
+
<img src="img/command_bot_help_echo.png" width="250">
|
274
|
+
|
294
275
|
|
295
276
|
When you call a command that is not recognized, you will get suggestions from the Smart Bot.
|
296
277
|
|
@@ -368,15 +349,17 @@ Also you can always call the Smart Bot from any channel, even from channels with
|
|
368
349
|
|
369
350
|
You can run Ruby code by using the command: **_`ruby THE_CODE`_**.
|
370
351
|
|
371
|
-
Example:
|
372
|
-
|
373
|
-
|
352
|
+
Example:
|
353
|
+
<img src="img/command_ruby.png" width="650">
|
354
|
+
|
374
355
|
|
375
356
|
Also it is possible to attach a Ruby file and the Smart Bot will run and post the output. You need to select Ruby as file format. Or if you prefer it you can call the `ruby` command and on the same message supply a code block.
|
376
357
|
|
377
358
|
#### REPL
|
378
359
|
> for all users
|
379
360
|
|
361
|
+
[![SmartBot REPLs](https://img.youtube.com/vi/URMI3BdD7J8/0.jpg)](https://www.youtube.com/watch?v=URMI3BdD7J8)
|
362
|
+
|
380
363
|
Easily starts a REPL session so you will be able to create a script directly from the slack conversation. You will be able to share the REPL so they can run it or see the content.
|
381
364
|
|
382
365
|
It Will run all we write as a ruby command and will keep the session values until we finish the session sending `quit`, `exit` or `bye`
|
@@ -406,28 +389,16 @@ Examples:
|
|
406
389
|
_repl_
|
407
390
|
|
408
391
|
|
409
|
-
Running Example:
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
>**_Smart-Bot>_** `{ :name => "kLam", :job => "leader" }`
|
420
|
-
>**_Peter>_** `10.times { http.post(request.generate) } `
|
421
|
-
>**_Smart-Bot>_** `10`
|
422
|
-
>**_Peter>_** `puts "10 Random Users Created"`
|
423
|
-
>**_Smart-Bot>_** `10 Random Users Created`
|
424
|
-
>**_Peter>_** `quit`
|
425
|
-
>**_Smart-Bot>_** `REPL session finished: Create10RandomUsers`
|
426
|
-
|
427
|
-
|
428
|
-
>**_Peter>_** `run repl Create10RandomUsers`
|
429
|
-
>**_Smart-Bot>_** `Running REPL Create10RandomUsers`
|
430
|
-
>**_Smart-Bot>_** `Create10RandomUsers: 10 Random Users Created`
|
392
|
+
Running Example:
|
393
|
+
<img src="img/command_repl1.png" width="650">
|
394
|
+
|
395
|
+
<img src="img/command_repl2.png" width="650">
|
396
|
+
|
397
|
+
|
398
|
+
Runnning on demand the repl we created:
|
399
|
+
|
400
|
+
<img src="img/command_run_repl.png" width="400">
|
401
|
+
|
431
402
|
|
432
403
|
You can run repls and supply parameters to the repl that will be executed on the same session just before the repl. [More info](https://github.com/MarioRuiz/slack-smart-bot/issues/60)
|
433
404
|
Example:
|
@@ -456,13 +427,11 @@ If you have for example a rule like this: **_`run tests on customers android app
|
|
456
427
|
From that moment you will be able to run the command: **_`run tca`_**
|
457
428
|
|
458
429
|
That shortcut will be available for you, in case you want to make it available for everybody on the channel:
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
`ES4799209592433480943244`
|
465
|
-
`ES8888795057132445752702`
|
430
|
+
|
431
|
+
Example:
|
432
|
+
|
433
|
+
<img src="img/command_add_sc.png" width="650">
|
434
|
+
|
466
435
|
|
467
436
|
In case you want to use a shortcut as a inline shortcut inside a command you can do it by adding a $:
|
468
437
|
Example:
|
@@ -491,7 +460,9 @@ Examples:
|
|
491
460
|
>**_Peter>_** `add announcement Party will start at 20:00 :tada:`
|
492
461
|
>**_Peter>_** `add :heavy_exclamation_mark: message Pay attention all DB are on maintenance until 20:00 GMT`
|
493
462
|
|
494
|
-
To see the announcements of the channel: **_`see announcements`_**, **_`see COLOR announcements`_**, **_`see EMOJI announcements`_** and to delete a particular announcement: **_`delete announcement ID`_**
|
463
|
+
To see the announcements of the channel: **_`see announcements`_**, **_`see COLOR announcements`_**, **_`see EMOJI announcements`_** and to delete a particular announcement: **_`delete announcement ID`_**
|
464
|
+
|
465
|
+
<img src="img/command_see_announcements.png" width="650">
|
495
466
|
|
496
467
|
If you are a master admin and you are on master channel then you can call **_`publish announcements`_** that will publish the announcements on all channels. The messages stored on a DM won't be published. This is very convenient to be called from a *Routine* for example every weekday at 09:00.
|
497
468
|
|
@@ -521,7 +492,9 @@ Examples:
|
|
521
492
|
>**_Peter>_** `who is not on vacation?`
|
522
493
|
>**_Peter>_** `who is on vacation? #SalesChannel`
|
523
494
|
>**_Peter>_** `who is on :working-from-home:`
|
524
|
-
>**_Peter>_** `who is available?`
|
495
|
+
>**_Peter>_** `who is available?`
|
496
|
+
|
497
|
+
<img src="img/command_see_statuses.png" width="400">
|
525
498
|
|
526
499
|
### Routines
|
527
500
|
> for admins
|
@@ -556,7 +529,7 @@ Other routine commands:
|
|
556
529
|
### Loops
|
557
530
|
> for all users
|
558
531
|
|
559
|
-
You can run any command or rule on a loop by using:
|
532
|
+
You can run *any command* or rule on a loop by using:
|
560
533
|
**_`for NUMBER times every NUMBER minutes COMMAND`_**
|
561
534
|
**_`for NUMBER times every NUMBER seconds COMMAND`_**
|
562
535
|
Maximum number of times to be used: 24. Minimum every 10 seconds. Maximum every 60 minutes.
|
@@ -569,6 +542,8 @@ Examples:
|
|
569
542
|
>**_`quit loop 1`_**
|
570
543
|
>**_`stop iterator 12`_**
|
571
544
|
|
545
|
+
<img src="img/command_loop.png" width="500">
|
546
|
+
|
572
547
|
### Control who has access to a command
|
573
548
|
> for admins
|
574
549
|
|
@@ -646,6 +621,8 @@ Examples:
|
|
646
621
|
### Teams
|
647
622
|
> for all users
|
648
623
|
|
624
|
+
[![SmartBot Teams](https://img.youtube.com/vi/u8B4aGDXH9M/0.jpg)](https://www.youtube.com/watch?v=u8B4aGDXH9M)
|
625
|
+
|
649
626
|
You can add, update, see, ping and delete teams. When calling `see TEAM_NAME team` the availability of the members will be displayed.
|
650
627
|
`add team TEAM_NAME PROPERTIES` will add a team with the info supplied. In case it is supplied a channel with type 'members' the members of that channel would be considered members of the team.
|
651
628
|
|
@@ -703,8 +680,12 @@ Examples:
|
|
703
680
|
>**_`sales team memo 4 Put it on hold until tests for Apple feature are finished`_**
|
704
681
|
>**_`sales team memo 7`_**
|
705
682
|
|
683
|
+
<img src="img/command_see_team.png" width="650">
|
684
|
+
|
685
|
+
|
706
686
|
Other team commands: **_`delete team TEAM_NAME`_**, **_`delete memo ID from team TEAM_NAME`_**, **_`set STATUS on memo ID TEAM_NAME team`_**, **_`see MEMO_TYPE from TEAM_NAME team TOPIC`_**
|
707
687
|
|
688
|
+
|
708
689
|
### Time off management
|
709
690
|
> for all users
|
710
691
|
|
@@ -736,7 +717,7 @@ settings = {
|
|
736
717
|
|
737
718
|
When calling `see my time off` on a DM will display a calendar of the year with the days off, including public holidays
|
738
719
|
|
739
|
-
<img src="img/
|
720
|
+
<img src="img/command_my_timeoff.png" width="750">
|
740
721
|
|
741
722
|
Other 'time off' commands: **_`remove time off ID`_**, **_`see my time off`_**, **_`see vacations @USER`_**, **_`time off team NAME`_**, **_`set public holidays to COUNTRY/REGION`_**
|
742
723
|
|
@@ -754,7 +735,7 @@ ai: {
|
|
754
735
|
access_token: 'OPENAI_ACCESS_TOKEN',
|
755
736
|
organization_id: 'OPENAI_ORGANIZATION_ID',
|
756
737
|
gpt_model: 'gpt-3.5-turbo',
|
757
|
-
whisper_model
|
738
|
+
whisper_model: 'whisper-1',
|
758
739
|
image_size: '256x256'
|
759
740
|
}
|
760
741
|
}
|
@@ -116,6 +116,7 @@ class SlackSmartBot
|
|
116
116
|
end
|
117
117
|
output.each do |h|
|
118
118
|
msg = h.gsub(/^\s*command_id:\s+:\w+\s*$/,'')
|
119
|
+
msg.gsub!(/^\s*>.+$/,'') if help_command.to_s != ''
|
119
120
|
unless msg.match?(/\A\s*\z/)
|
120
121
|
respond msg, dest, unfurl_links: false, unfurl_media: false
|
121
122
|
end
|
@@ -86,6 +86,7 @@ class SlackSmartBot
|
|
86
86
|
bye_bot(dest, user.name, display_name)
|
87
87
|
|
88
88
|
# help: ----------------------------------------------
|
89
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#announcements|ANNOUNCEMENTS>*
|
89
90
|
# help: `add announcement MESSAGE`
|
90
91
|
# help: `add red announcement MESSAGE`
|
91
92
|
# help: `add green announcement MESSAGE`
|
@@ -162,6 +163,7 @@ class SlackSmartBot
|
|
162
163
|
|
163
164
|
|
164
165
|
# help: ----------------------------------------------
|
166
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#share-messages|SHARE MESSAGES>*
|
165
167
|
# help: `share messages /REGEXP/ on #CHANNEL`
|
166
168
|
# help: `share messages "TEXT" on #CHANNEL`
|
167
169
|
# xhelp: `share messages :EMOJI: on #CHANNEL`
|
@@ -395,6 +397,7 @@ class SlackSmartBot
|
|
395
397
|
end
|
396
398
|
|
397
399
|
# help: ----------------------------------------------
|
400
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#teams|TEAMS>*
|
398
401
|
# help: `add team TEAM_NAME members #TEAM_CHANNEL CHANNEL_TYPE #CHANNEL1 #CHANNEL99 : INFO`
|
399
402
|
# help: `add team TEAM_NAME MEMBER_TYPE @USER1 @USER99 CHANNEL_TYPE #CHANNEL1 #CHANNEL99 : INFO`
|
400
403
|
# help: `add team TEAM_NAME MEMBER_TYPE1 @USER1 @USER99 MEMBER_TYPE99 @USER1 @USER99 CHANNEL_TYPE1 #CHANNEL1 #CHANNEL99 CHANNEL_TYPE99 #CHANNEL1 #CHANNEL99 : INFO`
|
@@ -662,6 +665,7 @@ class SlackSmartBot
|
|
662
665
|
see_memos_team(user, type: type, name: name, topic: topic)
|
663
666
|
|
664
667
|
# help: ----------------------------------------------
|
668
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#time-off-management|TIME OFF MANAGEMENT>*
|
665
669
|
# help: `add vacation from YYYY/MM/DD to YYYY/MM/DD`
|
666
670
|
# help: `add vacation YYYY/MM/DD`
|
667
671
|
# help: `add sick from YYYY/MM/DD to YYYY/MM/DD`
|
@@ -826,6 +830,7 @@ class SlackSmartBot
|
|
826
830
|
personal_settings(user, settings_type, settings_id, settings_value)
|
827
831
|
|
828
832
|
# help: ----------------------------------------------
|
833
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#openai|OpenAI>*
|
829
834
|
# help: `?w`
|
830
835
|
# help: `?w PROMPT`
|
831
836
|
# help: OpenAI: It will transcribe the audio file attached and performed the PROMPT indicated if supplied.
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class SlackSmartBot
|
2
2
|
|
3
3
|
# help: ----------------------------------------------
|
4
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#shortcuts|SHORTCUTS>*
|
4
5
|
# help: `add shortcut NAME: COMMAND`
|
5
6
|
# help: `add sc NAME: COMMAND`
|
6
7
|
# help: `add shortcut for all NAME: COMMAND`
|
@@ -26,6 +27,7 @@ class SlackSmartBot
|
|
26
27
|
unless typem == :on_extended
|
27
28
|
from = user.name
|
28
29
|
if has_access?(__method__, user)
|
30
|
+
shortcut_name.strip!
|
29
31
|
if global
|
30
32
|
if !config.on_master_bot or typem != :on_master
|
31
33
|
respond "It is only possible to add global shortcuts from Master channel"
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class SlackSmartBot
|
2
2
|
# helpadmin: ----------------------------------------------
|
3
|
+
# helpadmin: >*<https://github.com/MarioRuiz/slack-smart-bot#routines|ROUTINES>*
|
3
4
|
# helpadmin: `add routine NAME every NUMBER PERIOD COMMAND`
|
4
5
|
# helpadmin: `add routine NAME every NUMBER PERIOD #CHANNEL COMMAND`
|
5
6
|
# helpadmin: `add routine NAME every NUMBER PERIOD`
|
@@ -14,8 +14,8 @@ class SlackSmartBot
|
|
14
14
|
unless typem == :on_extended
|
15
15
|
from = user.name
|
16
16
|
if has_access?(__method__, user)
|
17
|
-
deleted = false
|
18
|
-
|
17
|
+
deleted = false
|
18
|
+
shortcut.strip!
|
19
19
|
if global
|
20
20
|
if !config.on_master_bot or typem != :on_master
|
21
21
|
respond "It is only possible to delete global shortcuts from Master channel"
|
data/whats_new.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
*Version 1.14.
|
1
|
+
*Version 1.14.1* Released 2023-Apr-13
|
2
2
|
|
3
3
|
*For General users*
|
4
4
|
- `team TEAM_NAME memo ID MESSAGE`, `TEAM_NAME team memo ID MESSAGE` It will add a comment to the memo ID specified on the team specified. (<https://github.com/MarioRuiz/slack-smart-bot/issues/95|#95>).
|
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: 1.14.
|
4
|
+
version: 1.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slack-ruby-client
|
@@ -65,6 +65,9 @@ dependencies:
|
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '3'
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 3.7.0
|
68
71
|
type: :runtime
|
69
72
|
prerelease: false
|
70
73
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -72,6 +75,9 @@ dependencies:
|
|
72
75
|
- - "~>"
|
73
76
|
- !ruby/object:Gem::Version
|
74
77
|
version: '3'
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 3.7.0
|
75
81
|
- !ruby/object:Gem::Dependency
|
76
82
|
name: nice_hash
|
77
83
|
requirement: !ruby/object:Gem::Requirement
|