slack-smart-bot 1.14.0 → 1.14.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fef5b10f464c14059a0c350c44e0bbb86c7c92db0f60a05516982c79e4764159
4
- data.tar.gz: 5fa566a1f3198e1021a5a1f3ae6759e0814eeafa394e7acad2117bf0661d2cfe
3
+ metadata.gz: 37c704bfddd83d7a7d34f9b15cea3cf8d1f01dde28c11c9e9bea01fb6ac9db19
4
+ data.tar.gz: 9785ce98b6695b77aaf89a0e239142e2443a4d812c2dcb1fe3119953f516d023
5
5
  SHA512:
6
- metadata.gz: 2a73bdd8c22589f205997f00723e15b791805430b4c614f33ea0abe32dee48fc5c6e9f8b7bd0709eb35376e133e40389c12e5efc7e0f5b8f871553cfe9f0b4f3
7
- data.tar.gz: a98455b32e704fb57a84c6df1df523f0967a8499bf1c61bbda079f951b9f4b854e65f02395f2b85743e93ef05eb9ac505a57f452af9b0399ea362982392ac9ab
6
+ metadata.gz: 8e287b2173246c2adc1805738c87a6428ef43776213294558e1e900b29a03094df9b16d44b3a754d7b52d6a774a1a44da946cb553c4a5c9e83ca76b651239a1a
7
+ data.tar.gz: 9100ceee4ac4efd07a9ae4fae9d9014d00417626b0650bcd9bfa3824ff4070812cd9dfc79bbf26d68b088a43600ad22a469a40c137f4d9634066e9c2d133a596
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
- >**_Peter>_** `@smart-bot echo Example`
239
- >**_Smart-Bot>_** `Example`
236
+ <img src="img/commands_on_demand.png" width="400">
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
- >**_Peter>_** `@smart-bot on #the_channel ruby puts Time.now`
253
- >**_Smart-Bot>_** `2019-10-23 12:43:42 +0000`
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
- >**_Peter>_** ``-!This text won't be treated but this one yes `ruby puts 'a'` and also this one `ruby puts 'b'` ``
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="400">
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
- >**_Peter>_** `bot help echo`
292
- >**_Smart-Bot>_** `echo SOMETHING`
293
- `repeats SOMETHING`
272
+ Example:
273
+ <img src="img/command_bot_help_echo.png" width="300">
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,9 +349,9 @@ 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
- >**_Peter>_** `!ruby require 'json'; res=[]; 20.times {res.push rand(100)}; my_json={result: res}; puts my_json.to_json`
373
- >**_Smart-Bot>_** `{"result":[63,66,35,83,44,40,72,25,59,73,75,54,56,91,19,6,68,1,25,3]}`
352
+ Example:
353
+ <img src="img/command_ruby.png" width="500">
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
 
@@ -406,28 +387,16 @@ Examples:
406
387
  _repl_
407
388
 
408
389
 
409
- Running Example:
410
- >**_Peter>_** `!repl Create10RandomUsers: "This is just an example"`
411
- >**_Smart-Bot>_** `Session name: *Create10RandomUsers*`
412
- >**_Peter>_** `http = NiceHttp.new("https://reqres.in/")`
413
- >**_Smart-Bot>_** `#<NiceHttp:0x00007fc6e216e328 @host="reqres.in", @port=443...>`
414
- >**_Peter>_** `request ||= { path: '/api/users' }`
415
- >**_Smart-Bot>_** `{ :path => "/api/users" }`
416
- >**_Peter>_** `request.data = { name: '1-10:L', job: 'leader|worker' }`
417
- >**_Smart-Bot>_** `{ :name => "1-10:L", :job => "leader|worker" }`
418
- >**_Peter>_** `request.data.generate`
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`
390
+ Running Example:
391
+ <img src="img/command_repl1.png" width="600">
392
+
393
+ <img src="img/command_repl2.png" width="600">
394
+
395
+
396
+ Runnning on demand the repl we created:
397
+
398
+ <img src="img/command_run_repl.png" width="400">
399
+
431
400
 
432
401
  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
402
  Example:
@@ -456,13 +425,11 @@ If you have for example a rule like this: **_`run tests on customers android app
456
425
  From that moment you will be able to run the command: **_`run tca`_**
457
426
 
458
427
  That shortcut will be available for you, in case you want to make it available for everybody on the channel:
459
- Example:
460
- >**_Peter>_** `!add shortcut for all spanish bank account: ruby require 'iso/iban'; 3.times {puts ISO::IBAN.random('ES')}`
461
- >**_Smart-Bot>_** `shortcut added`
462
- >**_John>_** `!spanish bank account`
463
- >**_Smart-Bot>_** `ES4664553191352006861448`
464
- `ES4799209592433480943244`
465
- `ES8888795057132445752702`
428
+
429
+ Example:
430
+
431
+ <img src="img/command_add_sc.png" width="500">
432
+
466
433
 
467
434
  In case you want to use a shortcut as a inline shortcut inside a command you can do it by adding a $:
468
435
  Example:
@@ -491,7 +458,9 @@ Examples:
491
458
  >**_Peter>_** `add announcement Party will start at 20:00 :tada:`
492
459
  >**_Peter>_** `add :heavy_exclamation_mark: message Pay attention all DB are on maintenance until 20:00 GMT`
493
460
 
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`_**
461
+ To see the announcements of the channel: **_`see announcements`_**, **_`see COLOR announcements`_**, **_`see EMOJI announcements`_** and to delete a particular announcement: **_`delete announcement ID`_**
462
+
463
+ <img src="img/command_see_announcements.png" width="500">
495
464
 
496
465
  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
466
 
@@ -521,7 +490,9 @@ Examples:
521
490
  >**_Peter>_** `who is not on vacation?`
522
491
  >**_Peter>_** `who is on vacation? #SalesChannel`
523
492
  >**_Peter>_** `who is on :working-from-home:`
524
- >**_Peter>_** `who is available?`
493
+ >**_Peter>_** `who is available?`
494
+
495
+ <img src="img/command_see_statuses.png" width="400">
525
496
 
526
497
  ### Routines
527
498
  > for admins
@@ -556,7 +527,7 @@ Other routine commands:
556
527
  ### Loops
557
528
  > for all users
558
529
 
559
- You can run any command or rule on a loop by using:
530
+ You can run *any command* or rule on a loop by using:
560
531
  **_`for NUMBER times every NUMBER minutes COMMAND`_**
561
532
  **_`for NUMBER times every NUMBER seconds COMMAND`_**
562
533
  Maximum number of times to be used: 24. Minimum every 10 seconds. Maximum every 60 minutes.
@@ -569,6 +540,8 @@ Examples:
569
540
  >**_`quit loop 1`_**
570
541
  >**_`stop iterator 12`_**
571
542
 
543
+ <img src="img/command_loop.png" width="400">
544
+
572
545
  ### Control who has access to a command
573
546
  > for admins
574
547
 
@@ -703,8 +676,12 @@ Examples:
703
676
  >**_`sales team memo 4 Put it on hold until tests for Apple feature are finished`_**
704
677
  >**_`sales team memo 7`_**
705
678
 
679
+ <img src="img/command_see_team.png" width="600">
680
+
681
+
706
682
  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
683
 
684
+
708
685
  ### Time off management
709
686
  > for all users
710
687
 
@@ -736,7 +713,7 @@ settings = {
736
713
 
737
714
  When calling `see my time off` on a DM will display a calendar of the year with the days off, including public holidays
738
715
 
739
- <img src="img/my_timeoff.png" width="650">
716
+ <img src="img/command_my_timeoff.png" width="650">
740
717
 
741
718
  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
719
 
@@ -26,6 +26,7 @@ class SlackSmartBot
26
26
  unless typem == :on_extended
27
27
  from = user.name
28
28
  if has_access?(__method__, user)
29
+ shortcut_name.strip!
29
30
  if global
30
31
  if !config.on_master_bot or typem != :on_master
31
32
  respond "It is only possible to add global shortcuts from Master channel"
@@ -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.0* Released 2023-Apr-13
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-smart-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Ruiz