slack-smart-bot 1.14.1 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +237 -48
- data/img/chat_gpt.png +0 -0
- data/img/chat_gpt_session.png +0 -0
- data/img/chat_gpt_share.png +0 -0
- data/img/command_add_sc.png +0 -0
- data/img/command_bot_help_echo.png +0 -0
- data/img/command_loop.png +0 -0
- data/img/command_my_timeoff.png +0 -0
- data/img/command_recap.png +0 -0
- data/img/command_repl1.png +0 -0
- data/img/command_repl2.png +0 -0
- data/img/command_ruby.png +0 -0
- data/img/command_run_repl.png +0 -0
- data/img/command_see_announcements.png +0 -0
- data/img/command_see_statuses.png +0 -0
- data/img/command_see_team.png +0 -0
- data/img/command_summarize.png +0 -0
- data/img/commands_inline.png +0 -0
- data/img/commands_on_demand.png +0 -0
- data/img/commands_on_external_call.png +0 -0
- data/img/image_editing.png +0 -0
- data/img/image_generation.png +0 -0
- data/img/image_variations.png +0 -0
- data/img/openai-300.png +0 -0
- data/img/openai.png +0 -0
- data/img/slack-300.png +0 -0
- data/img/slack.png +0 -0
- data/img/smart-bot-150.png +0 -0
- data/img/smart-bot-profile-pic-2.png +0 -0
- data/img/smart-bot-profile-pic.png +0 -0
- data/img/smart-bot.png +0 -0
- data/img/whisper.png +0 -0
- data/lib/slack/smart-bot/ai/open_ai/connect.rb +165 -43
- data/lib/slack/smart-bot/ai/open_ai/models.rb +61 -9
- data/lib/slack/smart-bot/ai/open_ai/send_gpt_chat.rb +67 -11
- data/lib/slack/smart-bot/ai/open_ai/send_image_edit.rb +4 -3
- data/lib/slack/smart-bot/ai/open_ai/send_image_generation.rb +4 -4
- data/lib/slack/smart-bot/ai/open_ai/send_image_variation.rb +4 -3
- data/lib/slack/smart-bot/ai/open_ai/whisper_transcribe.rb +4 -3
- data/lib/slack/smart-bot/comm/ask.rb +20 -8
- data/lib/slack/smart-bot/comm/dont_understand.rb +2 -2
- data/lib/slack/smart-bot/comm/event_hello.rb +30 -1
- data/lib/slack/smart-bot/comm/get_channel_members.rb +2 -1
- data/lib/slack/smart-bot/comm/get_presence.rb +1 -0
- data/lib/slack/smart-bot/comm/get_smartbot_team_info.rb +10 -0
- data/lib/slack/smart-bot/comm/get_user_info.rb +45 -6
- data/lib/slack/smart-bot/comm/get_users.rb +8 -1
- data/lib/slack/smart-bot/comm/respond.rb +225 -196
- data/lib/slack/smart-bot/comm/send_msg_channel.rb +2 -2
- data/lib/slack/smart-bot/comm/send_msg_user.rb +10 -9
- data/lib/slack/smart-bot/comm/unreact.rb +2 -2
- data/lib/slack/smart-bot/comm.rb +1 -0
- data/lib/slack/smart-bot/commands/general/add_admin.rb +16 -6
- data/lib/slack/smart-bot/commands/general/add_announcement.rb +3 -3
- data/lib/slack/smart-bot/commands/general/add_vacation.rb +28 -12
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat.rb +272 -23
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_add_collaborator.rb +42 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_copy_session.rb +89 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_delete_session.rb +45 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_get_prompts.rb +41 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_list_sessions.rb +81 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_share_session.rb +52 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_use_model.rb +52 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_edit_image.rb +14 -11
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_generate_image.rb +15 -11
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_models.rb +29 -17
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_variations_image.rb +16 -13
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_whisper.rb +13 -7
- data/lib/slack/smart-bot/commands/general/allow_access.rb +8 -4
- data/lib/slack/smart-bot/commands/general/bot_help.rb +24 -9
- data/lib/slack/smart-bot/commands/general/bye_bot.rb +9 -5
- data/lib/slack/smart-bot/commands/general/delete_announcement.rb +2 -1
- data/lib/slack/smart-bot/commands/general/delete_share.rb +2 -1
- data/lib/slack/smart-bot/commands/general/deny_access.rb +1 -1
- data/lib/slack/smart-bot/commands/general/get_smartbot_readme.rb +15 -0
- data/lib/slack/smart-bot/commands/general/hi_bot.rb +10 -4
- data/lib/slack/smart-bot/commands/general/personal_settings.rb +26 -8
- data/lib/slack/smart-bot/commands/general/poster.rb +26 -2
- data/lib/slack/smart-bot/commands/general/public_holidays.rb +14 -24
- data/lib/slack/smart-bot/commands/general/recap.rb +399 -0
- data/lib/slack/smart-bot/commands/general/remove_admin.rb +19 -9
- data/lib/slack/smart-bot/commands/general/remove_vacation.rb +23 -6
- data/lib/slack/smart-bot/commands/general/see_access.rb +2 -1
- data/lib/slack/smart-bot/commands/general/see_admins.rb +8 -4
- data/lib/slack/smart-bot/commands/general/see_announcements.rb +5 -5
- data/lib/slack/smart-bot/commands/general/see_favorite_commands.rb +4 -4
- data/lib/slack/smart-bot/commands/general/see_shares.rb +1 -1
- data/lib/slack/smart-bot/commands/general/see_vacations.rb +34 -17
- data/lib/slack/smart-bot/commands/general/set_public_holidays.rb +4 -2
- data/lib/slack/smart-bot/commands/general/share_messages.rb +3 -3
- data/lib/slack/smart-bot/commands/general/summarize.rb +191 -0
- data/lib/slack/smart-bot/commands/general/teams/add_team.rb +4 -8
- data/lib/slack/smart-bot/commands/general/teams/delete_team.rb +3 -3
- data/lib/slack/smart-bot/commands/general/teams/memos/add_memo_team.rb +34 -29
- data/lib/slack/smart-bot/commands/general/teams/memos/add_memo_team_comment.rb +1 -1
- data/lib/slack/smart-bot/commands/general/teams/memos/delete_memo_team.rb +6 -4
- data/lib/slack/smart-bot/commands/general/teams/memos/see_memo_team.rb +26 -15
- data/lib/slack/smart-bot/commands/general/teams/memos/see_memos_team.rb +33 -24
- data/lib/slack/smart-bot/commands/general/teams/memos/set_memo_status.rb +4 -4
- data/lib/slack/smart-bot/commands/general/teams/ping_team.rb +10 -8
- data/lib/slack/smart-bot/commands/general/teams/see_teams.rb +73 -61
- data/lib/slack/smart-bot/commands/general/teams/see_vacations_team.rb +28 -13
- data/lib/slack/smart-bot/commands/general/teams/update_team.rb +9 -9
- data/lib/slack/smart-bot/commands/general_bot_commands.rb +1153 -835
- data/lib/slack/smart-bot/commands/on_bot/add_shortcut.rb +19 -17
- data/lib/slack/smart-bot/commands/on_bot/admin/add_routine.rb +12 -9
- data/lib/slack/smart-bot/commands/on_bot/admin/remove_routine.rb +2 -0
- data/lib/slack/smart-bot/commands/on_bot/admin/run_routine.rb +1 -0
- data/lib/slack/smart-bot/commands/on_bot/admin/see_routines.rb +5 -3
- data/lib/slack/smart-bot/commands/on_bot/admin_master/delete_message.rb +2 -3
- data/lib/slack/smart-bot/commands/on_bot/admin_master/get_bot_logs.rb +2 -3
- data/lib/slack/smart-bot/commands/on_bot/admin_master/react_to.rb +2 -3
- data/lib/slack/smart-bot/commands/on_bot/admin_master/send_message.rb +7 -6
- data/lib/slack/smart-bot/commands/on_bot/admin_master/update_message.rb +2 -3
- data/lib/slack/smart-bot/commands/on_bot/delete_repl.rb +1 -1
- data/lib/slack/smart-bot/commands/on_bot/delete_shortcut.rb +21 -20
- data/lib/slack/smart-bot/commands/on_bot/general/bot_stats.rb +40 -7
- data/lib/slack/smart-bot/commands/on_bot/general/bot_status.rb +6 -2
- data/lib/slack/smart-bot/commands/on_bot/general/stop_using_rules.rb +7 -6
- data/lib/slack/smart-bot/commands/on_bot/general/suggest_command.rb +5 -4
- data/lib/slack/smart-bot/commands/on_bot/general/use_rules.rb +4 -3
- data/lib/slack/smart-bot/commands/on_bot/get_repl.rb +4 -4
- data/lib/slack/smart-bot/commands/on_bot/kill_repl.rb +1 -1
- data/lib/slack/smart-bot/commands/on_bot/repl.rb +110 -53
- data/lib/slack/smart-bot/commands/on_bot/repl_client.rb +35 -29
- data/lib/slack/smart-bot/commands/on_bot/run_repl.rb +5 -5
- data/lib/slack/smart-bot/commands/on_bot/see_repls.rb +1 -2
- data/lib/slack/smart-bot/commands/on_bot/see_shortcuts.rb +5 -4
- data/lib/slack/smart-bot/commands/on_extended/bot_rules.rb +22 -11
- data/lib/slack/smart-bot/commands/on_master/admin_master/exit_bot.rb +12 -7
- data/lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb +2 -2
- data/lib/slack/smart-bot/commands/on_master/admin_master/publish_announcements.rb +1 -1
- data/lib/slack/smart-bot/commands/on_master/admin_master/set_general_message.rb +5 -5
- data/lib/slack/smart-bot/commands/on_master/admin_master/set_maintenance.rb +5 -5
- data/lib/slack/smart-bot/commands/on_master/create_bot.rb +3 -3
- data/lib/slack/smart-bot/commands.rb +10 -0
- data/lib/slack/smart-bot/config.rb +126 -0
- data/lib/slack/smart-bot/listen.rb +12 -11
- data/lib/slack/smart-bot/process.rb +62 -55
- data/lib/slack/smart-bot/process_first.rb +106 -65
- data/lib/slack/smart-bot/treat_message.rb +79 -47
- data/lib/slack/smart-bot/utils/answer.rb +11 -3
- data/lib/slack/smart-bot/utils/answer_delete.rb +11 -3
- data/lib/slack/smart-bot/utils/check_vacations.rb +21 -3
- data/lib/slack/smart-bot/utils/create_routine_thread.rb +13 -13
- data/lib/slack/smart-bot/utils/display_calendar.rb +42 -8
- data/lib/slack/smart-bot/utils/encryption/decrypt.rb +16 -9
- data/lib/slack/smart-bot/utils/encryption/encrypt.rb +14 -11
- data/lib/slack/smart-bot/utils/find_user.rb +71 -0
- data/lib/slack/smart-bot/utils/get_access_channels.rb +22 -3
- data/lib/slack/smart-bot/utils/get_channels_name_and_id.rb +3 -4
- data/lib/slack/smart-bot/utils/get_command_ids.rb +5 -5
- data/lib/slack/smart-bot/utils/get_countries_candelarific.rb +18 -0
- data/lib/slack/smart-bot/utils/get_help.rb +21 -19
- data/lib/slack/smart-bot/utils/get_openai_sessions.rb +47 -0
- data/lib/slack/smart-bot/utils/get_personal_settings.rb +29 -3
- data/lib/slack/smart-bot/utils/get_rules_imported.rb +27 -6
- data/lib/slack/smart-bot/utils/get_shares.rb +1 -1
- data/lib/slack/smart-bot/utils/get_team_members.rb +4 -4
- data/lib/slack/smart-bot/utils/get_vacations.rb +15 -7
- data/lib/slack/smart-bot/utils/has_access.rb +10 -4
- data/lib/slack/smart-bot/utils/is_admin.rb +25 -17
- data/lib/slack/smart-bot/utils/local_time.rb +29 -0
- data/lib/slack/smart-bot/utils/save_stats.rb +5 -3
- data/lib/slack/smart-bot/utils/update_access_channels.rb +19 -3
- data/lib/slack/smart-bot/utils/update_openai_sessions.rb +42 -0
- data/lib/slack/smart-bot/utils/update_personal_settings.rb +11 -3
- data/lib/slack/smart-bot/utils/update_rules_imported.rb +18 -3
- data/lib/slack/smart-bot/utils/update_vacations.rb +5 -2
- data/lib/slack/smart-bot/utils/upgrade_to_use_team_ids.rb +276 -0
- data/lib/slack/smart-bot/utils.rb +6 -1
- data/lib/slack-smart-bot.rb +182 -76
- data/lib/slack-smart-bot_general_commands.rb +10 -9
- data/whats_new.txt +30 -13
- metadata +152 -18
@@ -2,7 +2,6 @@ class SlackSmartBot
|
|
2
2
|
|
3
3
|
# add here the general commands you will be using in any channel where The SmartBot is part of. Not necessary to use ! or ^, it will answer directly.
|
4
4
|
def general_bot_commands(user, command, dest, files = [])
|
5
|
-
|
6
5
|
begin
|
7
6
|
if config.simulate
|
8
7
|
display_name = user.profile.display_name
|
@@ -12,66 +11,84 @@ class SlackSmartBot
|
|
12
11
|
end
|
13
12
|
display_name = user.profile.display_name
|
14
13
|
end
|
14
|
+
|
15
15
|
case command
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# help: `NUMBER times every NUMBER minutes COMMAND`
|
36
|
-
# help: `NUMBER times every NUMBER seconds COMMAND`
|
37
|
-
# help: It will run the command every NUMBER minutes or seconds for NUMBER times.
|
38
|
-
# help: max 24 times. min every 10 seconds. max every 60 minutes.
|
39
|
-
# help: Call `quit loop LOOP_ID` to stop the loop.
|
40
|
-
# help: aliases for minutes: m, minute, minutes
|
41
|
-
# help: aliases for seconds: s, sc, second, seconds
|
42
|
-
# help: Examples:
|
43
|
-
# help: _for 5 times every 1 minute ^ruby puts Time.now_
|
44
|
-
# help: _10 times every 30s !ruby puts Time.now_
|
45
|
-
# help: _24 times every 60m !get sales today_
|
46
|
-
# help: <https://github.com/MarioRuiz/slack-smart-bot#loops|more info>
|
47
|
-
# help: command_id: :create_loop
|
48
|
-
# help:
|
16
|
+
# help: ----------------------------------------------
|
17
|
+
# help: `bot help`
|
18
|
+
# help: `bot help COMMAND`
|
19
|
+
# help: `bot rules`
|
20
|
+
# help: `bot rules COMMAND`
|
21
|
+
# help: `bot help expanded`
|
22
|
+
# help: `bot rules expanded`
|
23
|
+
# help: `bot what can I do?`
|
24
|
+
# help: `<bot help`
|
25
|
+
# help: `<bot rules`
|
26
|
+
# help: it will display this help. For a more detailed help call `bot help expanded` or `bot rules expanded`.
|
27
|
+
# help: if COMMAND supplied just help for that command
|
28
|
+
# help: you can use the option 'expanded' or the alias 'extended'
|
29
|
+
# help: `bot rules` will show only the specific rules for this channel.
|
30
|
+
# help: if added '<' at the beginning the help will be sent as a snippet on MD format. Click on the icon for 'Open in new window' to see it on a browser.
|
31
|
+
# help: You can install this extension in Google Chrome to view it: https://chromewebstore.google.com/detail/medapdbncneneejhbgcjceippjlfkmkg
|
32
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#bot-help|more info>
|
33
|
+
# help: command_id: :bot_help
|
34
|
+
# help:
|
49
35
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
36
|
+
# help: ----------------------------------------------
|
37
|
+
# help: `get smartbot readme`
|
38
|
+
# help: `smartbot readme`
|
39
|
+
# help: `readme smartbot`
|
40
|
+
# help: It will send the README.md file to the channel.
|
41
|
+
# help: To open the file on a browser click on the icon for 'Open in new window'
|
42
|
+
# help: You can install this extension in Google Chrome to view it: https://chromewebstore.google.com/detail/medapdbncneneejhbgcjceippjlfkmkg
|
43
|
+
# help: command_id: :get_smartbot_readme
|
44
|
+
# help:
|
45
|
+
when /^\A*(get\s+)?smartbot\s+readme\s*\z/i, /^\A*readme\s+smartbot\s*\z/i
|
46
|
+
get_smartbot_readme(dest)
|
47
|
+
|
48
|
+
# help: ----------------------------------------------
|
49
|
+
# help: `for NUMBER times every NUMBER minutes COMMAND`
|
50
|
+
# help: `for NUMBER times every NUMBER seconds COMMAND`
|
51
|
+
# help: `NUMBER times every NUMBER minutes COMMAND`
|
52
|
+
# help: `NUMBER times every NUMBER seconds COMMAND`
|
53
|
+
# help: It will run the command every NUMBER minutes or seconds for NUMBER times.
|
54
|
+
# help: max 24 times. min every 10 seconds. max every 60 minutes.
|
55
|
+
# help: Call `quit loop LOOP_ID` to stop the loop.
|
56
|
+
# help: aliases for minutes: m, minute, minutes
|
57
|
+
# help: aliases for seconds: s, sc, second, seconds
|
58
|
+
# help: Examples:
|
59
|
+
# help: _for 5 times every 1 minute ^ruby puts Time.now_
|
60
|
+
# help: _10 times every 30s !ruby puts Time.now_
|
61
|
+
# help: _24 times every 60m !get sales today_
|
62
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#loops|more info>
|
63
|
+
# help: command_id: :create_loop
|
64
|
+
# help:
|
65
|
+
|
66
|
+
# help: ----------------------------------------------
|
67
|
+
# help: `quit loop LOOP_ID`
|
68
|
+
# help: It will stop the loop with the id LOOP_ID.
|
69
|
+
# help: Only the user who created the loop or an admin can stop it.
|
70
|
+
# help: aliases for loop: iterator, iteration
|
71
|
+
# help: aliases for quit: stop, exit, kill
|
72
|
+
# help: Examples:
|
73
|
+
# help: _quit loop 1_
|
74
|
+
# help: _stop iterator 12_
|
75
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#loops|more info>
|
76
|
+
# help: command_id: :quit_loop
|
77
|
+
# help:
|
78
|
+
|
79
|
+
# help: ----------------------------------------------
|
80
|
+
# help: `Hi Bot`
|
81
|
+
# help: `Hi Smart`
|
82
|
+
# help: `Hello Bot` `Hola Bot` `Hallo Bot` `What's up Bot` `Hey Bot` `Hæ Bot`
|
83
|
+
# help: `Hello THE_NAME_OF_THE_BOT`
|
84
|
+
# help: Bot starts listening to you if you are on a Bot channel
|
85
|
+
# help: After that if you want to avoid a single message to be treated by the smart bot, start the message by -
|
86
|
+
# help: Also apart of Hello you can use _Hallo, Hi, Hola, What's up, Hey, Hæ_
|
87
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#how-to-access-the-smart-bot|more info>
|
88
|
+
# help: command_id: :hi_bot
|
89
|
+
# help:
|
90
|
+
when /\A\s*(Hello|Hallo|Hi|Hola|What's\sup|Hey|Hæ)\s+(#{@salutations.join("|")})\s*$/i
|
91
|
+
hi_bot(user, dest, user.name, display_name)
|
75
92
|
|
76
93
|
# help: ----------------------------------------------
|
77
94
|
# help: `Bye Bot`
|
@@ -82,776 +99,797 @@ class SlackSmartBot
|
|
82
99
|
# help: <https://github.com/MarioRuiz/slack-smart-bot#how-to-access-the-smart-bot|more info>
|
83
100
|
# help: command_id: :bye_bot
|
84
101
|
# help:
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
# help: ----------------------------------------------
|
89
|
-
# help: `add announcement MESSAGE`
|
90
|
-
# help: `add red announcement MESSAGE`
|
91
|
-
# help: `add green announcement MESSAGE`
|
92
|
-
# help: `add yellow announcement MESSAGE`
|
93
|
-
# help: `add white announcement MESSAGE`
|
94
|
-
# help: `add EMOJI announcement MESSAGE`
|
95
|
-
# help: It will store the message on the announcement list labeled with the color or emoji specified, white by default.
|
96
|
-
# help: aliases for announcement: statement, declaration, message
|
97
|
-
# help: Examples:
|
98
|
-
# help: _add green announcement :heavy_check_mark: All customer services are up and running_
|
99
|
-
# help: _add red declaration Customers db is down :x:_
|
100
|
-
# help: _add yellow statement Don't access the linux server without VPN_
|
101
|
-
# help: _add message `*Party* will start at *20:00* :tada:`_
|
102
|
-
# help: _add :heavy_exclamation_mark: message Pay attention all DB are on maintenance until 20:00 GMT_
|
103
|
-
# help: <https://github.com/MarioRuiz/slack-smart-bot#announcements|more info>
|
104
|
-
# help: command_id: :add_announcement
|
105
|
-
# help:
|
106
|
-
when /\A\s*(add|create)\s+(red\s+|green\s+|white\s+|yellow\s+)?(announcement|statement|declaration|message)\s+(.+)\s*\z/i,
|
107
|
-
/\A\s*(add|create)\s+(:[\w\-]+:)\s+(announcement|statement|declaration|message)\s+(.+)\s*\z/i
|
108
|
-
type = $2.to_s.downcase.strip
|
109
|
-
type = 'white' if type == ''
|
110
|
-
message = $4
|
111
|
-
add_announcement(user, type, message)
|
112
|
-
|
113
|
-
|
114
|
-
# help: ----------------------------------------------
|
115
|
-
# help: `delete announcement ID`
|
116
|
-
# help: It will delete the message on the announcement list.
|
117
|
-
# help: aliases for announcement: statement, declaration, message
|
118
|
-
# help: Examples:
|
119
|
-
# help: _delete announcement 24_
|
120
|
-
# help: _delete message 645_
|
121
|
-
# help: _delete statement 77_
|
122
|
-
# help: _delete declaration 334_
|
123
|
-
# help: <https://github.com/MarioRuiz/slack-smart-bot#announcements|more info>
|
124
|
-
# help: command_id: :delete_announcement
|
125
|
-
# help:
|
126
|
-
when /\A\s*(delete|remove)\s+(announcement|statement|declaration|message)\s+(\d+)\s*\z/i
|
127
|
-
message_id = $3
|
128
|
-
delete_announcement(user, message_id)
|
129
|
-
|
130
|
-
# help: ----------------------------------------------
|
131
|
-
# help: `see announcements`
|
132
|
-
# help: `see red announcements`
|
133
|
-
# help: `see green announcements`
|
134
|
-
# help: `see yellow announcements`
|
135
|
-
# help: `see white announcements`
|
136
|
-
# help: `see EMOJI announcements`
|
137
|
-
# helpmaster: `see announcements #CHANNEL`
|
138
|
-
# helpmaster: `see all announcements`
|
139
|
-
# help: It will display the announcements for the channel.
|
140
|
-
# help: aliases for announcements: statements, declarations, messages
|
141
|
-
# helpmaster: In case #CHANNEL it will display the announcements for that channel. Only master admins can use it from a DM with the Smartbot.
|
142
|
-
# helpmaster: In case 'all' it will display all the announcements for all channels. Only master admins can use it from a DM with the Smartbot.
|
143
|
-
# help: Examples:
|
144
|
-
# help: _see announcements_
|
145
|
-
# help: _see white messages_
|
146
|
-
# help: _see red statements_
|
147
|
-
# help: _see yellow declarations_
|
148
|
-
# help: _see messages_
|
149
|
-
# help: _see :heavy_exclamation_mark: messages_
|
150
|
-
# help: <https://github.com/MarioRuiz/slack-smart-bot#announcements|more info>
|
151
|
-
# help: command_id: :see_announcements
|
152
|
-
# help:
|
153
|
-
when /\A\s*see\s+(red\s+|green\s+|white\s+|yellow\s+|:[\w\-]+:\s+)?(announcements|statements|declarations|messages)()\s*\z/i,
|
154
|
-
/\A\s*see\s+(all\s+)?(announcements|statements|declarations|messages)()\s*\z/i,
|
155
|
-
/\A\s*see\s+(red\s+|green\s+|white\s+|yellow\s+|:[\w\-]+:\s+)?(announcements|statements|declarations|messages)\s+#([\w\-]+)\s*\z/i,
|
156
|
-
/\A\s*see\s+(red\s+|green\s+|white\s+|yellow\s+|:[\w\-]+:\s+)?(announcements|statements|declarations|messages)\s+<#(\w+)\|.*>\s*\z/i
|
157
|
-
|
158
|
-
type = $1.to_s.downcase.strip
|
159
|
-
channel = $3.to_s
|
160
|
-
|
161
|
-
see_announcements(user, type, channel)
|
162
|
-
|
163
|
-
|
164
|
-
# help: ----------------------------------------------
|
165
|
-
# help: `share messages /REGEXP/ on #CHANNEL`
|
166
|
-
# help: `share messages "TEXT" on #CHANNEL`
|
167
|
-
# xhelp: `share messages :EMOJI: on #CHANNEL`
|
168
|
-
# help: It will automatically share new messages published that meet the specified criteria.
|
169
|
-
# xhelp: In case :EMOJI: it will share the messages with the indicated reaction.
|
170
|
-
# help: SmartBot user and user adding the share need to be members on both channels.
|
171
|
-
# help: The Regexp will automatically add the parameters /im
|
172
|
-
# help: Only available on public channels.
|
173
|
-
# help: Examples:
|
174
|
-
# help: _share messages /(last\s+|previous\s+)sales\s+results\s+/ on #sales_
|
175
|
-
# help: _share messages "share post" on #announcements_
|
176
|
-
# xhelp: _share messages :tada: on #announcements_
|
177
|
-
# xhelp: _share messages :moneybag: from #sales_
|
178
|
-
# help: <https://github.com/MarioRuiz/slack-smart-bot#share-messages|more info>
|
179
|
-
# help: command_id: :share_messages
|
180
|
-
# help:
|
181
|
-
when /\A\s*share\s+messages\s+(\/.+\/|".+"|'.+')\s+on\s+<#\w+\|(.+)>\s*\z/i,
|
182
|
-
/\A\s*share\s+messages\s+(\/.+\/|".+"|'.+')\s+on\s+<#(\w+)\|>\s*\z/,
|
183
|
-
/\A\s*share\s+messages\s+(\/.+\/|".+"|'.+')\s+on\s+(.+)\s*\z/i
|
184
|
-
condition = $1
|
185
|
-
channel = $2
|
186
|
-
channel.gsub!('#','') # for the case the channel name is in plain text including #
|
187
|
-
channel = @channels_name[channel] if @channels_name.key?(channel)
|
188
|
-
channel_from = @channels_name[dest]
|
189
|
-
channel_to = channel
|
190
|
-
share_messages(user, channel_from, channel_to, condition)
|
191
|
-
|
192
|
-
# help: ----------------------------------------------
|
193
|
-
# help: `see shares`
|
194
|
-
# help: It will display the active shares from this channel.
|
195
|
-
# help: <https://github.com/MarioRuiz/slack-smart-bot#share-messages|more info>
|
196
|
-
# help: command_id: :see_shares
|
197
|
-
# help:
|
198
|
-
when /\A\s*see\s+shares\s*\z/i
|
199
|
-
see_shares()
|
200
|
-
|
201
|
-
# help: ----------------------------------------------
|
202
|
-
# help: `delete share ID`
|
203
|
-
# help: It will delete the share id specified.
|
204
|
-
# help: Examples:
|
205
|
-
# help: _delete share 24_
|
206
|
-
# help: <https://github.com/MarioRuiz/slack-smart-bot#share-messages|more info>
|
207
|
-
# help: command_id: :delete_share
|
208
|
-
# help:
|
209
|
-
when /\A\s*(delete|remove)\s+share\s+(\d+)\s*\z/i
|
210
|
-
share_id = $2
|
211
|
-
delete_share(user, share_id)
|
212
|
-
|
213
|
-
# help: ----------------------------------------------
|
214
|
-
# help: `see statuses`
|
215
|
-
# help: `see statuses #CHANNEL`
|
216
|
-
# help: `see status EMOJI`
|
217
|
-
# help: `see status EMOJI #CHANNEL`
|
218
|
-
# help: `see status EMOJI1 EMOJI99`
|
219
|
-
# help: `who is on vacation?`
|
220
|
-
# help: `who is on EMOJI`
|
221
|
-
# help: `who is on EMOJI #CHANNEL`
|
222
|
-
# help: `who is on EMOJI1 EMOJI99`
|
223
|
-
# help: `who is not on vacation?`
|
224
|
-
# help: `who is not on EMOJI`
|
225
|
-
# help: `who is available?`
|
226
|
-
# help: It will display the current statuses of the members of the channel where you are calling the command or on the channel you supply.
|
227
|
-
# help: In case of `who is available?` will show members of the channel that are on line and not on a meeting or vacation or sick.
|
228
|
-
# help: <https://github.com/MarioRuiz/slack-smart-bot#see-statuses|more info>
|
229
|
-
# help: command_id: :see_statuses
|
230
|
-
# help:
|
231
|
-
when /\A\s*(see|get)\s+(statuses)()\s*\z/i,
|
232
|
-
/\A\s*(see\s+status|get\s+status|who\s+is\s+on|who\s+are\s+on|who\s+is\s+not\s+on|who\s+are\s+not\s+on)\s+(:[\w\-\:\s]+:)\s*\??()\s*\z/i,
|
233
|
-
/\A\s*(who\s+is\s+on|who\s+are\s+on|who\s+is\s+not\s+on|who\s+are\s+not\s+on)\s+(vacation|holiday)\s*\??()\s*\z/i,
|
234
|
-
/\A\s*(who\s+is|who\s+are)\s+(available|active)\s*\??()\s*\z/i,
|
235
|
-
/\A\s*(see|get)\s+(statuses)\s+#([\w\-]+)\s*\z/i,
|
236
|
-
/\A\s*(see\s+status|get\s+status|who\s+is\s+on|who\s+are\s+on|who\s+is\s+not\s+on|who\s+are\s+not\s+on)\s+(:[\w\-\:\s]+:)\s*\??\s+#([\w\-]+)\s*\z/i,
|
237
|
-
/\A\s*(who\s+is|who\s+are)\s+(available|active)\s*\??\s+#([\w\-]+)\s*\z/i,
|
238
|
-
/\A\s*(who\s+is|who\s+are)\s+(available|active)\s*\??\s+<#(\w+)\|.*>\s*\z/i,
|
239
|
-
/\A\s*(who\s+is\s+on|who\s+are\s+on|who\s+is\s+not\s+on|who\s+are\s+not\s+on)\s+(vacation|holiday)\s*\??\s+#([\w\-]+)\s*\z/i,
|
240
|
-
/\A\s*(see|get)\s+(statuses)\s+<#(\w+)\|.*>\s*\z/i,
|
241
|
-
/\A\s*(see\s+status|get\s+status|who\s+is\s+on|who\s+is\s+not\s+on|who\s+are\s+on|who\s+are\s+not\s+on)\s+(:[\w\-\:\s]+:)\s*\??\s+<#(\w+)\|.*>\s*\z/i,
|
242
|
-
/\A\s*(who\s+is\s+on|who\s+is\s+not\s+on|who\s+are\s+on|who\s+are\s+not\s+on)\s+(vacation|holiday)\s*\??\s+<#(\w+)\|.*>\s*\z/i
|
243
|
-
|
244
|
-
not_on = $1.match?(/who\s+(is|are)\s+not\s+on/i)
|
245
|
-
type = $2.downcase
|
246
|
-
channel = $3.to_s
|
247
|
-
if type == 'statuses'
|
248
|
-
types = []
|
249
|
-
elsif type =='vacation' or type == 'holiday'
|
250
|
-
types = [':palm_tree:']
|
251
|
-
elsif type == 'available' or type == 'active'
|
252
|
-
types = ['available']
|
253
|
-
else
|
254
|
-
type.gsub!(' ', '')
|
255
|
-
type.gsub!('::',': :')
|
256
|
-
types = type.split(' ')
|
257
|
-
end
|
258
|
-
see_statuses(user, channel, types, dest, not_on)
|
259
|
-
|
260
|
-
|
261
|
-
# help: ----------------------------------------------
|
262
|
-
# help: `see favorite commands`
|
263
|
-
# help: `see my favorite commands`
|
264
|
-
# help: `favorite commands`
|
265
|
-
# help: `my favorite commands`
|
266
|
-
# help: It will display the favorite commands.
|
267
|
-
# help: aliases for favorite: favourite, most used, fav
|
268
|
-
# helpmaster: You need to set stats to true to generate the stats when running the bot instance and get this info.
|
269
|
-
# help: <https://github.com/MarioRuiz/slack-smart-bot#see-favorite-commands|more info>
|
270
|
-
# help: command_id: :see_favorite_commands
|
271
|
-
# help:
|
272
|
-
when /\A\s*(see\s+)?(my\s+)?(fav|favorite|favourite|most\s+used)\s+commands\s*\z/i
|
273
|
-
only_mine = $2.to_s!=''
|
274
|
-
see_favorite_commands(user, only_mine)
|
275
|
-
|
276
|
-
# helpadmin: ----------------------------------------------
|
277
|
-
# helpadmin: `add admin @user`
|
278
|
-
# helpadmin: It will add @user as an admin of the channel.
|
279
|
-
# helpadmin: Only creator of the channel, admins and master admins can use this command.
|
280
|
-
# helpadmin: <https://github.com/MarioRuiz/slack-smart-bot#bot-management|more info>
|
281
|
-
# helpadmin: command_id: :add_admin
|
282
|
-
# helpadmin:
|
283
|
-
when /\A\s*add\s+admin\s+<@(\w+)>\s*\z/i
|
284
|
-
admin_user = $1
|
285
|
-
add_admin(user, admin_user)
|
286
|
-
|
287
|
-
# help: ----------------------------------------------
|
288
|
-
# help: `see admins`
|
289
|
-
# help: `show admins`
|
290
|
-
# help: `who are admins?`
|
291
|
-
# help: It will show who are the admins of the channel.
|
292
|
-
# help: <https://github.com/MarioRuiz/slack-smart-bot#bot-management|more info>
|
293
|
-
# help: command_id: :see_admins
|
294
|
-
# help:
|
295
|
-
when /\A\s*(see|show)\s+admins\s*\z/i, /\A\s*who\s+are\s+(the\s+)?admins\??\s*\z/i
|
296
|
-
see_admins()
|
297
|
-
|
298
|
-
# helpadmin: ----------------------------------------------
|
299
|
-
# helpadmin: `remove admin @user`
|
300
|
-
# helpadmin: It will remove the admin privileges for @user on the channel.
|
301
|
-
# helpadmin: Only creator of the channel, admins and master admins can use this command.
|
302
|
-
# helpadmin: <https://github.com/MarioRuiz/slack-smart-bot#bot-management|more info>
|
303
|
-
# helpadmin: command_id: :remove_admin
|
304
|
-
# helpadmin:
|
305
|
-
when /\A\s*(remove|delete)\s+admin\s+<@(\w+)>\s*\z/i
|
306
|
-
admin_user = $2
|
307
|
-
remove_admin(user, admin_user)
|
308
|
-
|
309
|
-
# helpadmin: ----------------------------------------------
|
310
|
-
# helpadmin: `see command ids`
|
311
|
-
# helpadmin: It will display all available command ids.
|
312
|
-
# helpadmin: The command id can be used on `bot stats command COMMAND_ID`, `allow access COMMAND_ID` and `deny access COMMAND_ID`
|
313
|
-
# helpadmin: Only creator of the channel, admins and master admins can use this command.
|
314
|
-
# helpadmin: <https://github.com/MarioRuiz/slack-smart-bot#bot-management|more info>
|
315
|
-
# helpadmin: command_id: :see_command_ids
|
316
|
-
# helpadmin:
|
317
|
-
when /\A\s*(see|display|get)\s+command(\s+|_)ids?\s*\z/i
|
318
|
-
see_command_ids()
|
319
|
-
|
320
|
-
# helpadmin: ----------------------------------------------
|
321
|
-
# helpadmin: `allow access COMMAND_ID`
|
322
|
-
# helpadmin: `allow access COMMAND_ID @user1 @user99`
|
323
|
-
# helpadmin: It will allow the specified command to be used on the channel.
|
324
|
-
# helpadmin: If @user specified, only those users will have access to the command.
|
325
|
-
# helpadmin: Only admins of the channel can use this command
|
326
|
-
# helpadmin: <https://github.com/MarioRuiz/slack-smart-bot#control-who-has-access-to-a-command|more info>
|
327
|
-
# helpadmin: command_id: :allow_access
|
328
|
-
# helpadmin:
|
329
|
-
when /\A\s*(allow|give)\s+access\s+(\w+)\s+(.+)\s*\z/i, /\A\s*(allow|give)\s+access\s+(\w+)()\s*\z/i
|
330
|
-
command_id = $2.downcase
|
331
|
-
opt = $3.to_s.split(' ')
|
332
|
-
allow_access(user, command_id, opt)
|
333
|
-
|
334
|
-
# helpadmin: ----------------------------------------------
|
335
|
-
# helpadmin: `deny access COMMAND_ID`
|
336
|
-
# helpadmin: It won't allow the specified command to be used on the channel.
|
337
|
-
# helpadmin: Only admins of the channel can use this command
|
338
|
-
# helpadmin: <https://github.com/MarioRuiz/slack-smart-bot#control-who-has-access-to-a-command|more info>
|
339
|
-
# helpadmin: command_id: :deny_access
|
340
|
-
# helpadmin:
|
341
|
-
when /\A\s*deny\s+access(\s+rights)?\s+(\w+)\s*\z/i
|
342
|
-
command_id = $2.downcase
|
343
|
-
deny_access(user, command_id)
|
344
|
-
|
345
|
-
|
346
|
-
# help: ----------------------------------------------
|
347
|
-
# help: `see access COMMAND_ID`
|
348
|
-
# help: It will show the access rights for the specified command.
|
349
|
-
# help: <https://github.com/MarioRuiz/slack-smart-bot#control-who-has-access-to-a-command|more info>
|
350
|
-
# help: command_id: :see_access
|
351
|
-
# help:
|
352
|
-
when /\A\s*(see|show)\s+access(\s+rights)?\s+(.+)\s*\z/i
|
353
|
-
command_id = $3.downcase
|
354
|
-
see_access(command_id)
|
355
|
-
|
356
|
-
# help: ----------------------------------------------
|
357
|
-
# help: `poster MESSAGE`
|
358
|
-
# help: `poster :EMOTICON_TEXT: MESSAGE`
|
359
|
-
# help: `poster :EMOTICON_TEXT: :EMOTICON_BACKGROUND: MESSAGE`
|
360
|
-
# help: `poster MINUTESm MESSAGE`
|
361
|
-
# help: It will create a poster with the message supplied. By default will be autodeleted 1 minute later.
|
362
|
-
# help: If you want the poster to be permanent then use the command `pposter`
|
363
|
-
# help: If minutes supplied then it will be deleted after the minutes specified. Maximum value 60.
|
364
|
-
# help: To see the messages on a mobile phone put the phone on landscape mode
|
365
|
-
# help: Max 15 characters. If the message is longer than that won't be treat it.
|
366
|
-
# help: Only letters from a to z, 0 to 9 and the chars: ? ! - + =
|
367
|
-
# help: To be displayed correctly use words with no more than 6 characters
|
368
|
-
# help: Examples:
|
369
|
-
# help: _poster nice work!_
|
370
|
-
# help: _poster :heart: nice work!_
|
371
|
-
# help: _poster :mac-spinning-wheel: :look: love!_
|
372
|
-
# help: _poster 25m :heart: woah!_
|
373
|
-
# help: command_id: :poster
|
374
|
-
# help:
|
375
|
-
when /\A()poster\s+(\d+m\s+)?(:[^:]+:)\s+(:[^:]+:)(.+)\s*\z/i, /\A()poster\s+(\d+m\s+)?(:.+:)\s+()(.+)\s*\z/i, /\A()poster\s+(\d+m\s+)?()()(.+)\s*\z/i,
|
376
|
-
/\A(p)poster\s+()(:[^:]+:)\s+(:[^:]+:)(.+)\s*\z/i, /\A(p)poster\s+()(:.+:)\s+()(.+)\s*\z/i, /\A(p)poster\s+()()()(.+)\s*\z/i
|
377
|
-
permanent = $1.to_s != ''
|
378
|
-
minutes = $2.to_s
|
379
|
-
emoticon_text = $3
|
380
|
-
emoticon_bg = $4
|
381
|
-
text = $5
|
382
|
-
minutes = minutes.scan(/(\d+)/).join
|
383
|
-
|
384
|
-
if minutes == ''
|
385
|
-
minutes = 1
|
386
|
-
elsif minutes.to_i > 60
|
387
|
-
minutes = 60
|
388
|
-
end
|
389
|
-
|
390
|
-
save_stats :poster
|
391
|
-
if text.to_s.gsub(/\s+/, '').length > 15
|
392
|
-
respond "Too long. Max 15 chars", :on_thread
|
393
|
-
else
|
394
|
-
poster(permanent, emoticon_text, emoticon_bg, text, minutes)
|
395
|
-
end
|
102
|
+
when /\A\s*(Bye|Bæ|Good\s+Bye|Adiós|Ciao|Bless|Bless\sBless|Adeu)\s+(#{@salutations.join("|")})\s*$/i
|
103
|
+
bye_bot(dest, user, display_name)
|
396
104
|
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
105
|
+
# help: ----------------------------------------------
|
106
|
+
# help: `poster MESSAGE`
|
107
|
+
# help: `poster :EMOTICON_TEXT: MESSAGE`
|
108
|
+
# help: `poster :EMOTICON_TEXT: :EMOTICON_BACKGROUND: MESSAGE`
|
109
|
+
# help: `poster MINUTESm MESSAGE`
|
110
|
+
# help: It will create a poster with the message supplied. By default will be autodeleted 1 minute later.
|
111
|
+
# help: If you want the poster to be permanent then use the command `pposter`
|
112
|
+
# help: If minutes supplied then it will be deleted after the minutes specified. Maximum value 60.
|
113
|
+
# help: To see the messages on a mobile phone put the phone on landscape mode
|
114
|
+
# help: Max 15 characters. If the message is longer than that won't be treat it.
|
115
|
+
# help: Only letters from a to z, 0 to 9 and the chars: ? ! - + =
|
116
|
+
# help: To be displayed correctly use words with no more than 6 characters
|
117
|
+
# help: Examples:
|
118
|
+
# help: _poster nice work!_
|
119
|
+
# help: _poster :heart: nice work!_
|
120
|
+
# help: _poster :mac-spinning-wheel: :look: love!_
|
121
|
+
# help: _poster 25m :heart: woah!_
|
122
|
+
# help: command_id: :poster
|
123
|
+
# help:
|
124
|
+
when /\A()poster\s+(\d+m\s+)?(:[^:]+:)\s+(:[^:]+:)(.+)\s*\z/i, /\A()poster\s+(\d+m\s+)?(:.+:)\s+()(.+)\s*\z/i, /\A()poster\s+(\d+m\s+)?()()(.+)\s*\z/i,
|
125
|
+
/\A(p)poster\s+()(:[^:]+:)\s+(:[^:]+:)(.+)\s*\z/i, /\A(p)poster\s+()(:.+:)\s+()(.+)\s*\z/i, /\A(p)poster\s+()()()(.+)\s*\z/i
|
126
|
+
permanent = $1.to_s != ""
|
127
|
+
minutes = $2.to_s
|
128
|
+
emoticon_text = $3
|
129
|
+
emoticon_bg = $4
|
130
|
+
text = $5
|
131
|
+
minutes = minutes.scan(/(\d+)/).join
|
132
|
+
|
133
|
+
if minutes == ""
|
134
|
+
minutes = 1
|
135
|
+
elsif minutes.to_i > 60
|
136
|
+
minutes = 60
|
137
|
+
end
|
138
|
+
|
139
|
+
save_stats :poster
|
140
|
+
if text.to_s.gsub(/\s+/, "").length > 15
|
141
|
+
respond "Too long. Max 15 chars", :on_thread
|
142
|
+
else
|
143
|
+
poster(permanent, emoticon_text, emoticon_bg, text, minutes)
|
144
|
+
end
|
145
|
+
|
146
|
+
# help: ----------------------------------------------
|
147
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#announcements|ANNOUNCEMENTS>*
|
148
|
+
# help: `add announcement MESSAGE`
|
149
|
+
# help: `add red announcement MESSAGE`
|
150
|
+
# help: `add green announcement MESSAGE`
|
151
|
+
# help: `add yellow announcement MESSAGE`
|
152
|
+
# help: `add white announcement MESSAGE`
|
153
|
+
# help: `add EMOJI announcement MESSAGE`
|
154
|
+
# help: It will store the message on the announcement list labeled with the color or emoji specified, white by default.
|
155
|
+
# help: aliases for announcement: statement, declaration, message
|
156
|
+
# help: Examples:
|
157
|
+
# help: _add green announcement :heavy_check_mark: All customer services are up and running_
|
158
|
+
# help: _add red declaration Customers db is down :x:_
|
159
|
+
# help: _add yellow statement Don't access the linux server without VPN_
|
160
|
+
# help: _add message `*Party* will start at *20:00* :tada:`_
|
161
|
+
# help: _add :heavy_exclamation_mark: message Pay attention all DB are on maintenance until 20:00 GMT_
|
162
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#announcements|more info>
|
163
|
+
# help: command_id: :add_announcement
|
164
|
+
# help:
|
165
|
+
when /\A\s*(add|create)\s+(red\s+|green\s+|white\s+|yellow\s+)?(announcement|statement|declaration|message)\s+(.+)\s*\z/i,
|
166
|
+
/\A\s*(add|create)\s+(:[\w\-]+:)\s+(announcement|statement|declaration|message)\s+(.+)\s*\z/i
|
167
|
+
type = $2.to_s.downcase.strip
|
168
|
+
type = "white" if type == ""
|
169
|
+
message = $4
|
170
|
+
add_announcement(user, type, message)
|
171
|
+
|
172
|
+
# help: ----------------------------------------------
|
173
|
+
# help: `delete announcement ID`
|
174
|
+
# help: It will delete the message on the announcement list.
|
175
|
+
# help: aliases for announcement: statement, declaration, message
|
176
|
+
# help: Examples:
|
177
|
+
# help: _delete announcement 24_
|
178
|
+
# help: _delete message 645_
|
179
|
+
# help: _delete statement 77_
|
180
|
+
# help: _delete declaration 334_
|
181
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#announcements|more info>
|
182
|
+
# help: command_id: :delete_announcement
|
183
|
+
# help:
|
184
|
+
when /\A\s*(delete|remove)\s+(announcement|statement|declaration|message)\s+(\d+)\s*\z/i
|
185
|
+
message_id = $3
|
186
|
+
delete_announcement(user, message_id)
|
187
|
+
|
188
|
+
# help: ----------------------------------------------
|
189
|
+
# help: `see announcements`
|
190
|
+
# help: `see red announcements`
|
191
|
+
# help: `see green announcements`
|
192
|
+
# help: `see yellow announcements`
|
193
|
+
# help: `see white announcements`
|
194
|
+
# help: `see EMOJI announcements`
|
195
|
+
# helpmaster: `see announcements #CHANNEL`
|
196
|
+
# helpmaster: `see all announcements`
|
197
|
+
# help: It will display the announcements for the channel.
|
198
|
+
# help: aliases for announcements: statements, declarations, messages
|
199
|
+
# helpmaster: In case #CHANNEL it will display the announcements for that channel. Only master admins can use it from a DM with the Smartbot.
|
200
|
+
# helpmaster: In case 'all' it will display all the announcements for all channels. Only master admins can use it from a DM with the Smartbot.
|
201
|
+
# help: Examples:
|
202
|
+
# help: _see announcements_
|
203
|
+
# help: _see white messages_
|
204
|
+
# help: _see red statements_
|
205
|
+
# help: _see yellow declarations_
|
206
|
+
# help: _see messages_
|
207
|
+
# help: _see :heavy_exclamation_mark: messages_
|
208
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#announcements|more info>
|
209
|
+
# help: command_id: :see_announcements
|
210
|
+
# help:
|
211
|
+
when /\A\s*see\s+(red\s+|green\s+|white\s+|yellow\s+|:[\w\-]+:\s+)?(announcements|statements|declarations|messages)()\s*\z/i,
|
212
|
+
/\A\s*see\s+(all\s+)?(announcements|statements|declarations|messages)()\s*\z/i,
|
213
|
+
/\A\s*see\s+(red\s+|green\s+|white\s+|yellow\s+|:[\w\-]+:\s+)?(announcements|statements|declarations|messages)\s+#([\w\-]+)\s*\z/i,
|
214
|
+
/\A\s*see\s+(red\s+|green\s+|white\s+|yellow\s+|:[\w\-]+:\s+)?(announcements|statements|declarations|messages)\s+<#(\w+)\|.*>\s*\z/i
|
215
|
+
type = $1.to_s.downcase.strip
|
216
|
+
channel = $3.to_s
|
217
|
+
|
218
|
+
see_announcements(user, type, channel)
|
219
|
+
|
220
|
+
# help: ----------------------------------------------
|
221
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#share-messages|SHARE MESSAGES>*
|
222
|
+
# help: `share messages /REGEXP/ on #CHANNEL`
|
223
|
+
# help: `share messages "TEXT" on #CHANNEL`
|
224
|
+
# xhelp: `share messages :EMOJI: on #CHANNEL`
|
225
|
+
# help: It will automatically share new messages published that meet the specified criteria.
|
226
|
+
# xhelp: In case :EMOJI: it will share the messages with the indicated reaction.
|
227
|
+
# help: SmartBot user and user adding the share need to be members on both channels.
|
228
|
+
# help: The Regexp will automatically add the parameters /im
|
229
|
+
# help: Only available on public channels.
|
230
|
+
# help: Examples:
|
231
|
+
# help: _share messages /(last\s+|previous\s+)sales\s+results\s+/ on #sales_
|
232
|
+
# help: _share messages "share post" on #announcements_
|
233
|
+
# xhelp: _share messages :tada: on #announcements_
|
234
|
+
# xhelp: _share messages :moneybag: from #sales_
|
235
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#share-messages|more info>
|
236
|
+
# help: command_id: :share_messages
|
237
|
+
# help:
|
238
|
+
when /\A\s*share\s+messages\s+(\/.+\/|".+"|'.+')\s+on\s+<#\w+\|(.+)>\s*\z/i,
|
239
|
+
/\A\s*share\s+messages\s+(\/.+\/|".+"|'.+')\s+on\s+<#(\w+)\|>\s*\z/,
|
240
|
+
/\A\s*share\s+messages\s+(\/.+\/|".+"|'.+')\s+on\s+(.+)\s*\z/i
|
241
|
+
condition = $1
|
242
|
+
channel = $2
|
243
|
+
channel.gsub!("#", "") # for the case the channel name is in plain text including #
|
244
|
+
channel = @channels_name[channel] if @channels_name.key?(channel)
|
245
|
+
channel_from = @channels_name[dest]
|
246
|
+
channel_to = channel
|
247
|
+
share_messages(user, channel_from, channel_to, condition)
|
248
|
+
|
249
|
+
# help: ----------------------------------------------
|
250
|
+
# help: `see shares`
|
251
|
+
# help: It will display the active shares from this channel.
|
252
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#share-messages|more info>
|
253
|
+
# help: command_id: :see_shares
|
254
|
+
# help:
|
255
|
+
when /\A\s*see\s+shares\s*\z/i
|
256
|
+
see_shares()
|
257
|
+
|
258
|
+
# help: ----------------------------------------------
|
259
|
+
# help: `delete share ID`
|
260
|
+
# help: It will delete the share id specified.
|
261
|
+
# help: Examples:
|
262
|
+
# help: _delete share 24_
|
263
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#share-messages|more info>
|
264
|
+
# help: command_id: :delete_share
|
265
|
+
# help:
|
266
|
+
when /\A\s*(delete|remove)\s+share\s+(\d+)\s*\z/i
|
267
|
+
share_id = $2
|
268
|
+
delete_share(user, share_id)
|
269
|
+
|
270
|
+
# help: ----------------------------------------------
|
271
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#see-statuses|SEE STATUSES>*
|
272
|
+
# help: `see statuses`
|
273
|
+
# help: `see statuses #CHANNEL`
|
274
|
+
# help: `see status EMOJI`
|
275
|
+
# help: `see status EMOJI #CHANNEL`
|
276
|
+
# help: `see status EMOJI1 EMOJI99`
|
277
|
+
# help: `who is on vacation?`
|
278
|
+
# help: `who is on EMOJI`
|
279
|
+
# help: `who is on EMOJI #CHANNEL`
|
280
|
+
# help: `who is on EMOJI1 EMOJI99`
|
281
|
+
# help: `who is not on vacation?`
|
282
|
+
# help: `who is not on EMOJI`
|
283
|
+
# help: `who is available?`
|
284
|
+
# help: It will display the current statuses of the members of the channel where you are calling the command or on the channel you supply.
|
285
|
+
# help: In case of `who is available?` will show members of the channel that are on line and not on a meeting or vacation or sick.
|
286
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#see-statuses|more info>
|
287
|
+
# help: command_id: :see_statuses
|
288
|
+
# help:
|
289
|
+
when /\A\s*(see|get)\s+(statuses)()\s*\z/i,
|
290
|
+
/\A\s*(see\s+status|get\s+status|who\s+is\s+on|who\s+are\s+on|who\s+is\s+not\s+on|who\s+are\s+not\s+on)\s+(:[\w\-\:\s]+:)\s*\??()\s*\z/i,
|
291
|
+
/\A\s*(who\s+is\s+on|who\s+are\s+on|who\s+is\s+not\s+on|who\s+are\s+not\s+on)\s+(vacation|holiday)\s*\??()\s*\z/i,
|
292
|
+
/\A\s*(who\s+is|who\s+are)\s+(available|active)\s*\??()\s*\z/i,
|
293
|
+
/\A\s*(see|get)\s+(statuses)\s+#([\w\-]+)\s*\z/i,
|
294
|
+
/\A\s*(see\s+status|get\s+status|who\s+is\s+on|who\s+are\s+on|who\s+is\s+not\s+on|who\s+are\s+not\s+on)\s+(:[\w\-\:\s]+:)\s*\??\s+#([\w\-]+)\s*\z/i,
|
295
|
+
/\A\s*(who\s+is|who\s+are)\s+(available|active)\s*\??\s+#([\w\-]+)\s*\z/i,
|
296
|
+
/\A\s*(who\s+is|who\s+are)\s+(available|active)\s*\??\s+<#(\w+)\|.*>\s*\z/i,
|
297
|
+
/\A\s*(who\s+is\s+on|who\s+are\s+on|who\s+is\s+not\s+on|who\s+are\s+not\s+on)\s+(vacation|holiday)\s*\??\s+#([\w\-]+)\s*\z/i,
|
298
|
+
/\A\s*(see|get)\s+(statuses)\s+<#(\w+)\|.*>\s*\z/i,
|
299
|
+
/\A\s*(see\s+status|get\s+status|who\s+is\s+on|who\s+is\s+not\s+on|who\s+are\s+on|who\s+are\s+not\s+on)\s+(:[\w\-\:\s]+:)\s*\??\s+<#(\w+)\|.*>\s*\z/i,
|
300
|
+
/\A\s*(who\s+is\s+on|who\s+is\s+not\s+on|who\s+are\s+on|who\s+are\s+not\s+on)\s+(vacation|holiday)\s*\??\s+<#(\w+)\|.*>\s*\z/i
|
301
|
+
not_on = $1.match?(/who\s+(is|are)\s+not\s+on/i)
|
302
|
+
type = $2.downcase
|
303
|
+
channel = $3.to_s
|
304
|
+
if type == "statuses"
|
305
|
+
types = []
|
306
|
+
elsif type == "vacation" or type == "holiday"
|
307
|
+
types = [":palm_tree:"]
|
308
|
+
elsif type == "available" or type == "active"
|
309
|
+
types = ["available"]
|
310
|
+
else
|
311
|
+
type.gsub!(" ", "")
|
312
|
+
type.gsub!("::", ": :")
|
313
|
+
types = type.split(" ")
|
314
|
+
end
|
315
|
+
see_statuses(user, channel, types, dest, not_on)
|
316
|
+
|
317
|
+
# help: ----------------------------------------------
|
318
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#see-favorite-commands|SEE FAVORITE COMMANDS>*
|
319
|
+
# help: `see favorite commands`
|
320
|
+
# help: `see my favorite commands`
|
321
|
+
# help: `favorite commands`
|
322
|
+
# help: `my favorite commands`
|
323
|
+
# help: It will display the favorite commands.
|
324
|
+
# help: aliases for favorite: favourite, most used, fav
|
325
|
+
# helpmaster: You need to set stats to true to generate the stats when running the bot instance and get this info.
|
326
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#see-favorite-commands|more info>
|
327
|
+
# help: command_id: :see_favorite_commands
|
328
|
+
# help:
|
329
|
+
when /\A\s*(see\s+)?(my\s+)?(fav|favorite|favourite|most\s+used)\s+commands\s*\z/i
|
330
|
+
only_mine = $2.to_s != ""
|
331
|
+
see_favorite_commands(user, only_mine)
|
332
|
+
|
333
|
+
# help: ----------------------------------------------
|
334
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#control-who-has-access-to-a-command|CONTROL ACCESS TO COMMANDS>*
|
335
|
+
# helpadmin: `add admin @user`
|
336
|
+
# helpadmin: It will add @user as an admin of the channel.
|
337
|
+
# helpadmin: Only creator of the channel, admins and master admins can use this command.
|
338
|
+
# helpadmin: <https://github.com/MarioRuiz/slack-smart-bot#bot-management|more info>
|
339
|
+
# helpadmin: command_id: :add_admin
|
340
|
+
# helpadmin:
|
341
|
+
when /\A\s*add\s+admin\s+<@(\w+)>\s*\z/i
|
342
|
+
admin_user = $1
|
343
|
+
add_admin(user, admin_user)
|
344
|
+
|
345
|
+
# help: ----------------------------------------------
|
346
|
+
# help: `see admins`
|
347
|
+
# help: `show admins`
|
348
|
+
# help: `who are admins?`
|
349
|
+
# help: It will show who are the admins of the channel.
|
350
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#bot-management|more info>
|
351
|
+
# help: command_id: :see_admins
|
352
|
+
# help:
|
353
|
+
when /\A\s*(see|show)\s+admins\s*\z/i, /\A\s*who\s+are\s+(the\s+)?admins\??\s*\z/i
|
354
|
+
see_admins()
|
355
|
+
|
356
|
+
# helpadmin: ----------------------------------------------
|
357
|
+
# helpadmin: `remove admin @user`
|
358
|
+
# helpadmin: It will remove the admin privileges for @user on the channel.
|
359
|
+
# helpadmin: Only creator of the channel, admins and master admins can use this command.
|
360
|
+
# helpadmin: <https://github.com/MarioRuiz/slack-smart-bot#bot-management|more info>
|
361
|
+
# helpadmin: command_id: :remove_admin
|
362
|
+
# helpadmin:
|
363
|
+
when /\A\s*(remove|delete)\s+admin\s+<@(\w+)>\s*\z/i
|
364
|
+
admin_user = $2
|
365
|
+
remove_admin(user, admin_user)
|
366
|
+
|
367
|
+
# helpadmin: ----------------------------------------------
|
368
|
+
# helpadmin: `see command ids`
|
369
|
+
# helpadmin: It will display all available command ids.
|
370
|
+
# helpadmin: The command id can be used on `bot stats command COMMAND_ID`, `allow access COMMAND_ID` and `deny access COMMAND_ID`
|
371
|
+
# helpadmin: Only creator of the channel, admins and master admins can use this command.
|
372
|
+
# helpadmin: <https://github.com/MarioRuiz/slack-smart-bot#bot-management|more info>
|
373
|
+
# helpadmin: command_id: :see_command_ids
|
374
|
+
# helpadmin:
|
375
|
+
when /\A\s*(see|display|get)\s+command(\s+|_)ids?\s*\z/i
|
376
|
+
see_command_ids()
|
377
|
+
|
378
|
+
# helpadmin: ----------------------------------------------
|
379
|
+
# helpadmin: `allow access COMMAND_ID`
|
380
|
+
# helpadmin: `allow access COMMAND_ID @user1 @user99`
|
381
|
+
# helpadmin: It will allow the specified command to be used on the channel.
|
382
|
+
# helpadmin: If @user specified, only those users will have access to the command.
|
383
|
+
# helpadmin: Only admins of the channel can use this command
|
384
|
+
# helpadmin: <https://github.com/MarioRuiz/slack-smart-bot#control-who-has-access-to-a-command|more info>
|
385
|
+
# helpadmin: command_id: :allow_access
|
386
|
+
# helpadmin:
|
387
|
+
when /\A\s*(allow|give)\s+access\s+(\w+)\s+(.+)\s*\z/i, /\A\s*(allow|give)\s+access\s+(\w+)()\s*\z/i
|
388
|
+
command_id = $2.downcase
|
389
|
+
opt = $3.to_s.split(" ")
|
390
|
+
allow_access(user, command_id, opt)
|
391
|
+
|
392
|
+
# helpadmin: ----------------------------------------------
|
393
|
+
# helpadmin: `deny access COMMAND_ID`
|
394
|
+
# helpadmin: It won't allow the specified command to be used on the channel.
|
395
|
+
# helpadmin: Only admins of the channel can use this command
|
396
|
+
# helpadmin: <https://github.com/MarioRuiz/slack-smart-bot#control-who-has-access-to-a-command|more info>
|
397
|
+
# helpadmin: command_id: :deny_access
|
398
|
+
# helpadmin:
|
399
|
+
when /\A\s*deny\s+access(\s+rights)?\s+(\w+)\s*\z/i
|
400
|
+
command_id = $2.downcase
|
401
|
+
deny_access(user, command_id)
|
402
|
+
|
403
|
+
# help: ----------------------------------------------
|
404
|
+
# help: `see access COMMAND_ID`
|
405
|
+
# help: It will show the access rights for the specified command.
|
406
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#control-who-has-access-to-a-command|more info>
|
407
|
+
# help: command_id: :see_access
|
408
|
+
# help:
|
409
|
+
when /\A\s*(see|show)\s+access(\s+rights)?\s+(.+)\s*\z/i
|
410
|
+
command_id = $3.downcase
|
411
|
+
see_access(command_id)
|
412
|
+
|
413
|
+
# help: ----------------------------------------------
|
414
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#teams|TEAMS>*
|
415
|
+
# help: `add team TEAM_NAME members #TEAM_CHANNEL CHANNEL_TYPE #CHANNEL1 #CHANNEL99 : INFO`
|
416
|
+
# help: `add team TEAM_NAME MEMBER_TYPE @USER1 @USER99 CHANNEL_TYPE #CHANNEL1 #CHANNEL99 : INFO`
|
417
|
+
# help: `add team TEAM_NAME MEMBER_TYPE1 @USER1 @USER99 MEMBER_TYPE99 @USER1 @USER99 CHANNEL_TYPE1 #CHANNEL1 #CHANNEL99 CHANNEL_TYPE99 #CHANNEL1 #CHANNEL99 : INFO`
|
418
|
+
# help: It will add a team with the info supplied.
|
419
|
+
# help: TEAM_NAME, TYPE: one word, a-z, A-Z, 0-9, - and _
|
420
|
+
# help: In case it is supplied a channel with type 'members' the members of that channel would be considered members of the team. The SmartBot needs to be a member of the channel.
|
421
|
+
# help: Examples:
|
422
|
+
# help: _add team sales members #sales support #sales-support public #sales-ff : Contact us if you need anything related to Sales. You can also send us an email at sales@ffxaja.com_
|
423
|
+
# help: _add team Sales manager @ann qa @peter @berglind dev @john @sam @marta members #sales support #sales-support public #sales-ff : Contact us if you need anything related to Sales. You can also send us an email at sales@ffxaja.com_
|
424
|
+
# help: _add team devweb qa @jim dev @johnja @cooke @luisa members #devweb support #devweb-support : We take care of the website_
|
425
|
+
# help: _add team sandex manager @sarah members #sandex : We take care of the sand_
|
426
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#teams|more info>
|
427
|
+
# help: command_id: :add_team
|
428
|
+
# help:
|
429
|
+
when /\A\s*add\s+team\s+([\w\-]+)\s+([^:]+)\s*:\s+(.+)\s*\z/im, /\A\s*add\s+([\w\-]+)\s+team\s+([^:]+)\s*:\s+(.+)\s*\z/im
|
430
|
+
name = $1.downcase
|
431
|
+
options = $2
|
432
|
+
info = Thread.current[:command_orig].to_s.gsub("\u00A0", " ").scan(/^[^:]+:\s*(.+)\s*$/im).join
|
433
|
+
add_team(user, name, options, info)
|
434
|
+
|
435
|
+
# help: ----------------------------------------------
|
436
|
+
# help: `add TYPE to TEAM_NAME team : MESSAGE`
|
437
|
+
# help: `add private TYPE to TEAM_NAME team : MESSAGE`
|
438
|
+
# help: `add personal TYPE to TEAM_NAME team : MESSAGE`
|
439
|
+
# help: `add TYPE to TEAM_NAME team TOPIC : MESSAGE`
|
440
|
+
# help: `add private TYPE to TEAM_NAME team TOPIC : MESSAGE`
|
441
|
+
# help: `add personal TYPE to TEAM_NAME team TOPIC : MESSAGE`
|
442
|
+
# help: It will add a memo to the team. The memos will be displayed with the team info.
|
443
|
+
# help: Only team members can add a memo.
|
444
|
+
# help: TYPE: memo, note, issue, task, feature, bug, jira, github
|
445
|
+
# help: TOPIC: one word, a-z, A-Z, 0-9, - and _
|
446
|
+
# help: If private then the memo will be only displayed to team members on a DM or the members channel.
|
447
|
+
# help: If personal then the memo will be only displayed to the creator on a DM.
|
448
|
+
# help: In case jira type supplied:
|
449
|
+
# help: The message should be an JQL URL, JQL string or an issue URL.
|
450
|
+
# help: To be able to use it you need to specify on the SmartBot settings the credentials.
|
451
|
+
# help: In case no TOPIC is supplied then it will create automatically the topics from the labels specified on every JIRA issue
|
452
|
+
# help: In case github type supplied:
|
453
|
+
# help: The message should be a github URL. You can filter by state (open/closed/all) and labels
|
454
|
+
# help: To be able to use it you need to specify on the SmartBot settings the github token.
|
455
|
+
# help: In case no TOPIC is supplied then it will create automatically the topics from the labels specified on every Github issue
|
456
|
+
# help: Examples:
|
457
|
+
# help: _add memo to sales team : Add tests for Michigan feature_
|
458
|
+
# help: _add private note to sales team : Bills will need to be deployed before Friday_
|
459
|
+
# help: _add memo to dev team web : Check last version_
|
460
|
+
# help: _add private bug to dev team SRE : Logs should not be accessible from outside VPN_
|
461
|
+
# help: _add memo sales team : Add tests for Michigan feature_
|
462
|
+
# help: _add memo team sales: Add tests for Michigan feature_
|
463
|
+
# help: _add personal memo team sales: Check my vacations_
|
464
|
+
# help: _add jira to sales team : labels = SalesT AND status != Done_
|
465
|
+
# help: _add github to sales team : PeterBale/SalesBoom/issues?state=open&labels=bug_
|
466
|
+
# help: _add github to sales team dev: PeterBale/DevProject/issues/71_
|
467
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#teams|more info>
|
468
|
+
# help: command_id: :add_memo_team
|
469
|
+
# help:
|
470
|
+
when /\A\s*add\s+(private\s+|personal\s+)?(memo|note|issue|task|feature|bug|jira|github)\s+(to\s+)?team\s+([\w\-]+)\s*([^:]+)?\s*:\s+(.+)\s*\z/im,
|
471
|
+
/\A\s*add\s+(private\s+|personal\s+)?(memo|note|issue|task|feature|bug|jira|github)\s+(to\s+)?([\w\-]+)\s+team\s*([^:]+)?\s*:\s+(.+)\s*\z/im
|
472
|
+
privacy = $1.to_s.strip.downcase
|
473
|
+
type = $2.downcase
|
474
|
+
team_name = $4.downcase
|
475
|
+
topic = $5.to_s.strip
|
476
|
+
message = Thread.current[:command_orig].to_s.gsub("\u00A0", " ").scan(/^[^:]+:\s*(.+)\s*$/im).join
|
477
|
+
add_memo_team(user, privacy, team_name, topic, type, message)
|
478
|
+
|
479
|
+
# help: ----------------------------------------------
|
480
|
+
# help: `delete memo ID from TEAM_NAME team`
|
481
|
+
# help: It will delete the supplied memo ID on the team specified.
|
482
|
+
# help: aliases for memo: note, issue, task, feature, bug, jira, github
|
483
|
+
# help: You have to be a member of the team, the creator or a Master admin to be able to delete a memo.
|
484
|
+
# help: Examples:
|
485
|
+
# help: _delete memo 32 from sales team_
|
486
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#teams|more info>
|
487
|
+
# help: command_id: :delete_memo_team
|
488
|
+
# help:
|
489
|
+
when /\A\s*(delete|remove)\s+(memo|note|issue|task|feature|bug|jira|github)\s+(\d+)\s+(from|on)\s+team\s+([\w\-]+)\s*\z/i,
|
490
|
+
/\A\s*(delete|remove)\s+(memo|note|issue|task|feature|bug|jira|github)\s+(\d+)\s+(from|on)\s+([\w\-]+)\s+team\s*\z/i
|
491
|
+
memo_id = $3
|
492
|
+
team_name = $5.downcase
|
493
|
+
delete_memo_team(user, team_name, memo_id)
|
494
|
+
|
495
|
+
# help: ----------------------------------------------
|
496
|
+
# help: `set memo ID on TEAM_NAME team STATUS`
|
497
|
+
# help: `set STATUS on memo ID TEAM_NAME team`
|
498
|
+
# help: It will assign to the ID specified the emoticon status indicated.
|
499
|
+
# help: aliases for memo: note, issue, task, feature, bug
|
500
|
+
# help: This command will be only for memo, note, issue, task, feature, bug. Not for jira or github.
|
501
|
+
# help: You have to be a member of the team, the creator or a Master admin to be able to set a status.
|
502
|
+
# help: Examples:
|
503
|
+
# help: _set memo 32 on sales team :runner:_
|
504
|
+
# help: _set bug 7 on team sales :heavy_check_mark:_
|
505
|
+
# help: _set :runner: on memo 6 sales team_
|
506
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#teams|more info>
|
507
|
+
# help: command_id: :set_memo_status
|
508
|
+
# help:
|
509
|
+
when /\A\s*(set)\s+(memo|note|issue|task|feature|bug)\s+(\d+)\s+on\s+team\s+([\w\-]+)\s+(:[\w\-]+:)\s*\z/i,
|
510
|
+
/\A\s*(set)\s+(memo|note|issue|task|feature|bug)\s+(\d+)\s+on\s+([\w\-]+)\s+team\s+(:[\w\-]+:)\s*\z/i
|
511
|
+
memo_id = $3
|
512
|
+
team_name = $4.downcase
|
513
|
+
status = $5
|
514
|
+
set_memo_status(user, team_name, memo_id, status)
|
515
|
+
when /\A\s*(set)\s+(:[\w\-]+:)\s+on\s+(memo|note|issue|task|feature|bug)\s+(\d+)\s+team\s+([\w\-]+)\s*\z/i,
|
516
|
+
/\A\s*(set)\s+(:[\w\-]+:)\s+on\s+(memo|note|issue|task|feature|bug)\s+(\d+)\s+([\w\-]+)\s+team\s*\z/i
|
517
|
+
memo_id = $4
|
518
|
+
team_name = $5.downcase
|
519
|
+
status = $2
|
520
|
+
set_memo_status(user, team_name, memo_id, status)
|
521
|
+
|
522
|
+
# help: ----------------------------------------------
|
523
|
+
# help: `team TEAM_NAME memo ID MESSAGE`
|
524
|
+
# help: `TEAM_NAME team memo ID MESSAGE`
|
525
|
+
# help: It will add a comment to the memo ID specified on the team specified.
|
526
|
+
# help: aliases for memo: note, issue, task, feature, bug
|
527
|
+
# help: Examples:
|
528
|
+
# help: _sales team memo 32 I have a question, is there any public data published?_
|
529
|
+
# help: _dev team task 77 putting this on hold until we get more info_
|
530
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#teams|more info>
|
531
|
+
# help: command_id: :add_memo_team_comment
|
532
|
+
# help:
|
533
|
+
when /\A\s*team\s+([\w\-]+)\s+(memo|note|issue|task|feature|bug)\s+(\d+)\s+(.+)\s*\z/im,
|
534
|
+
/\A\s*([\w\-]+)\s+team\s+(memo|note|issue|task|feature|bug)\s+(\d+)\s+(.+)\s*\z/im
|
535
|
+
team_name = $1.downcase
|
536
|
+
memo_id = $3
|
537
|
+
message = $4.to_s.strip
|
538
|
+
add_memo_team_comment(user, team_name, memo_id, message)
|
539
|
+
|
540
|
+
# help: ----------------------------------------------
|
541
|
+
# help: `team TEAM_NAME memo ID`
|
542
|
+
# help: `TEAM_NAME team memo ID`
|
543
|
+
# help: It will show the memo ID specified on the team specified.
|
544
|
+
# help: aliases for memo: note, issue, task, feature, bug
|
545
|
+
# help: Examples:
|
546
|
+
# help: _sales team memo 32_
|
547
|
+
# help: _dev team task 77_
|
548
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#teams|more info>
|
549
|
+
# help: command_id: :see_memo_team
|
550
|
+
# help:
|
551
|
+
when /\A\s*team\s+([\w\-]+)\s+(memo|note|issue|task|feature|bug)\s+(\d+)\s*\z/i,
|
552
|
+
/\A\s*([\w\-]+)\s+team\s+(memo|note|issue|task|feature|bug)\s+(\d+)\s*\z/i
|
553
|
+
team_name = $1.downcase
|
554
|
+
memo_id = $3
|
555
|
+
see_memo_team(user, team_name, memo_id)
|
556
|
+
|
557
|
+
# help: ----------------------------------------------
|
558
|
+
# help: `see teams`
|
559
|
+
# help: `see team TEAM_NAME`
|
560
|
+
# help: `team TEAM_NAME`
|
561
|
+
# help: `TEAM_NAME team`
|
562
|
+
# help: `TEAM_NAME team TOPIC`
|
563
|
+
# help: `which team @USER`
|
564
|
+
# help: `which team #CHANNEL`
|
565
|
+
# help: `which team TEXT_TO_SEARCH_ON_INFO`
|
566
|
+
# help: `which team does @USER belongs to?`
|
567
|
+
# help: It will display all teams or the team specified.
|
568
|
+
# help: In case a specific team it will show also the availability of the members.
|
569
|
+
# help: TOPIC: It will filter members, channels and memos by topic.
|
570
|
+
# help: Examples:
|
571
|
+
# help: _see teams_
|
572
|
+
# help: _see team Sales_
|
573
|
+
# help: _Dev team_
|
574
|
+
# help: _Sales team dev_
|
575
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#teams|more info>
|
576
|
+
# help: command_id: :see_teams
|
577
|
+
# help:
|
578
|
+
|
579
|
+
# help: ----------------------------------------------
|
580
|
+
# help: `update team TEAM_NAME NEW_TEAM_NAME`
|
581
|
+
# help: `update team TEAM_NAME : NEW_INFO`
|
582
|
+
# help: `update team TEAM_NAME add MEMBER_TYPE @USER`
|
583
|
+
# help: `update team TEAM_NAME add CHANNEL_TYPE #CHANNEL`
|
584
|
+
# help: `update team TEAM_NAME delete MEMBER_TYPE @USER`
|
585
|
+
# help: `update team TEAM_NAME delete CHANNEL_TYPE #CHANNEL`
|
586
|
+
# help: `update team TEAM_NAME delete @USER`
|
587
|
+
# help: `update team TEAM_NAME delete #CHANNEL`
|
588
|
+
# help: It will update a team with the info supplied.
|
589
|
+
# help: You have to be a member of the team, the creator or a Master admin to be able to update a team.
|
590
|
+
# help: Examples:
|
591
|
+
# help: _update team sales salesff_
|
592
|
+
# help: _update team salesff : Support for customers_
|
593
|
+
# help: _update sales team delete @sarah @peter_
|
594
|
+
# help: _update team sales delete public #sales_
|
595
|
+
# help: _update team sales delete #sales_support_
|
596
|
+
# help: _update sales team add public #salesff_
|
597
|
+
# help: _update sales team add qa @john @ben @ana_
|
598
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#teams|more info>
|
599
|
+
# help: command_id: :update_team
|
600
|
+
# help:
|
601
|
+
when /\A\s*update\s+team\s+([\w\-]+)\s+([\w\-]+)\s*\z/i, /\A\s*update\s+([\w\-]+)\s+team\s+([\w\-]+)\s*\z/i
|
602
|
+
name = $1.downcase
|
603
|
+
new_name = $2.downcase
|
604
|
+
update_team(user, name, new_name: new_name)
|
605
|
+
when /\A\s*update\s+team\s+([\w\-]+)\s*:\s+(.+)\s*\z/im, /\A\s*update\s+([\w\-]+)\s+team\s*:\s+(.+)\s*\z/im
|
606
|
+
name = $1.downcase
|
607
|
+
new_info = Thread.current[:command_orig].to_s.gsub("\u00A0", " ").scan(/^[^:]+:\s*(.+)\s*$/im).join
|
608
|
+
update_team(user, name, new_info: new_info)
|
609
|
+
when /\A\s*update\s+team\s+([\w\-]+)\s+(delete|remove)\s+(.+)\s*\z/i, /\A\s*update\s+([\w\-]+)\s+team\s+(delete|remove)\s+(.+)\s*\z/i
|
610
|
+
name = $1.downcase
|
611
|
+
delete_opts = $3
|
612
|
+
update_team(user, name, delete_opts: delete_opts)
|
613
|
+
when /\A\s*update\s+team\s+([\w\-]+)\s+add\s+(.+)\s*\z/i, /\A\s*update\s+([\w\-]+)\s+team\s+add\s+(.+)\s*\z/i
|
614
|
+
name = $1.downcase
|
615
|
+
add_opts = $2
|
616
|
+
update_team(user, name, add_opts: add_opts)
|
617
|
+
|
618
|
+
# help: ----------------------------------------------
|
619
|
+
# help: `ping team TEAM_NAME MEMBER_TYPE MESSAGE`
|
620
|
+
# help: `contact team TEAM_NAME MEMBER_TYPE MESSAGE`
|
621
|
+
# help: ping: It will send the MESSAGE naming all available members of the MEMBER_TYPE supplied.
|
622
|
+
# help: contact: It will send the MESSAGE naming all members of the MEMBER_TYPE supplied.
|
623
|
+
# help: In case MEMBER_TYPE is 'all' it will name 10 random members of the team
|
624
|
+
# help: Examples:
|
625
|
+
# help: _ping team sales development How is the status on the last feature_
|
626
|
+
# help: _contact team sales qa Please finish testing of dev02 feature before noon_
|
627
|
+
# help: _contact team qa all Check the test failures please_
|
628
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#teams|more info>
|
629
|
+
# help: command_id: :ping_team
|
630
|
+
# help: command_id: :contact_team
|
631
|
+
# help:
|
632
|
+
when /\A\s*(contact|ping)\s+team\s+([\w\-]+)\s+([\w\-]+)\s+(.+)\s*\z/im, /\A\s*(contact|ping)\s+([\w\-]+)\s+team\s+([\w\-]+)\s+(.+)\s*\z/im
|
633
|
+
type = $1.downcase.to_sym
|
634
|
+
name = $2.downcase
|
635
|
+
member_type = $3.downcase
|
636
|
+
message = Thread.current[:command_orig].to_s.gsub("\u00A0", " ").gsub(/\A\^/, "").gsub(/\A!!/, "").gsub(/\A!/, "").scan(/\A\s*[\w]+\s+\w+\s+team\s+[\w\-]+\s+(.+)\s*\z/im).join
|
637
|
+
if message == ""
|
638
|
+
message = Thread.current[:command_orig].to_s.gsub("\u00A0", " ").gsub(/\A\^/, "").gsub(/\A!!/, "").gsub(/\A!/, "").scan(/\A\s*[\w]+\s+team\s+\w+\s+[\w\-]+\s+(.+)\s*\z/im).join
|
639
|
+
end
|
640
|
+
ping_team(user, type, name, member_type, message)
|
792
641
|
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
642
|
+
# help: ----------------------------------------------
|
643
|
+
# help: `delete team TEAM_NAME`
|
644
|
+
# help: It will delete the supplied team.
|
645
|
+
# help: You have to be a member of the team, the creator or a Master admin to be able to delete a team.
|
646
|
+
# help: Examples:
|
647
|
+
# help: _delete team sales_
|
648
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#teams|more info>
|
649
|
+
# help: command_id: :delete_team
|
650
|
+
# help:
|
651
|
+
when /\A\s*(delete|remove)\s+team\s+([\w\-]+)\s*\z/i, /\A\s*(delete|remove)\s+([\w\-]+)\s+team\s*\z/i
|
652
|
+
name = $2.downcase
|
653
|
+
delete_team(user, name)
|
654
|
+
when /\A\s*(see\s+)?(vacations|time\s+off)\s+team\s+([\w\-]+)\s*(\d\d\d\d\/\d\d\/\d\d)?\s*\z/i,
|
655
|
+
/\A\s*(see\s+)?(vacations|time\s+off)\s+([\w\-]+)\s+team\s*(\d\d\d\d\/\d\d\/\d\d)?\s*\z/i,
|
656
|
+
/\A\s*(see\s+)?(vacations|time\s+off)\s+team\s+([\w\-]+)\s*(\d\d\d\d-\d\d-\d\d)?\s*\z/i,
|
657
|
+
/\A\s*(see\s+)?(vacations|time\s+off)\s+([\w\-]+)\s+team\s*(\d\d\d\d-\d\d-\d\d)?\s*\z/i
|
658
|
+
team_name = $3.downcase
|
659
|
+
date = $4.to_s
|
660
|
+
date = Date.today.strftime("%Y/%m/%d") if date.empty?
|
661
|
+
react :running
|
662
|
+
see_vacations_team(user, team_name, date)
|
663
|
+
unreact :running
|
664
|
+
when /\A\s*(which|search)\s+teams?\s+(is\s+)?(.+)\??\s*\z/i, /\A\s*which\s+team\s+does\s+()()(.+)\s+belongs\s+to\??\s*\z/i
|
665
|
+
search = $3.to_s.downcase
|
666
|
+
see_teams(user, "", search)
|
667
|
+
when /\A\s*see\s+teams?\s*([\w\-]+)?\s*()\z/i,
|
668
|
+
/\A\s*team\s+([\w\-]+)\s*()\z/i, /\A\s*([\w\-]+)\s+team\s*()\z/i,
|
669
|
+
/\A\s*team\s+([\w\-]+)\s+([\w\-]+)\z/i, /\A\s*([\w\-]+)\s+team\s+([\w\-]+)\z/i,
|
670
|
+
/\A\s*see\s+all\s+teams\s*()()\z/i
|
671
|
+
name = $1.to_s.downcase
|
672
|
+
type = $2.to_s.downcase
|
673
|
+
see_teams(user, name, ttype: type)
|
674
|
+
|
675
|
+
# help: ----------------------------------------------
|
676
|
+
# help: `see MEMO_TYPE from TEAM_NAME team`
|
677
|
+
# help: `see MEMO_TYPE from TEAM_NAME team TOPIC`
|
678
|
+
# help: `see all memos from TEAM_NAME team`
|
679
|
+
# help: `see all memos from TEAM_NAME team TOPIC`
|
680
|
+
# help: It will show the memos of the team.
|
681
|
+
# help: If TOPIC is supplied it will show the memos of the topic.
|
682
|
+
# help: MEMO_TYPE: memos, notes, issues, tasks, features, bugs, jira, github. In case of 'all memos' will display all of any type.
|
683
|
+
# help: Examples:
|
684
|
+
# help: _see memos from sales team_
|
685
|
+
# help: _see bugs from sales team_
|
686
|
+
# help: _see all memos from sales team webdev_
|
687
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#teams|more info>
|
688
|
+
# help: command_id: :see_memos_team
|
689
|
+
# help:
|
690
|
+
when /\A\s*(see\s+)?(memo|note|issue|task|feature|bug|jira|github|all\s+memo)s?\s+(from\s+)?([\w\-]+)\s+team(.*)\s*\z/i,
|
691
|
+
/\A\s*(see\s+)?(memo|note|issue|task|feature|bug|jira|github|all\s+memo)s?\s+(from\s+)?team\s+([\w\-]+)(.*)\s*\z/i
|
692
|
+
type = $2.downcase.to_sym
|
693
|
+
name = $4.downcase
|
694
|
+
topic = $5.strip
|
695
|
+
see_memos_team(user, type: type, name: name, topic: topic)
|
696
|
+
|
697
|
+
# help: ----------------------------------------------
|
698
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#time-off-management|TIME OFF MANAGEMENT>*
|
699
|
+
# help: `add vacation from YYYY/MM/DD to YYYY/MM/DD`
|
700
|
+
# help: `add vacation YYYY/MM/DD`
|
701
|
+
# help: `add sick from YYYY/MM/DD to YYYY/MM/DD`
|
702
|
+
# help: `add sick YYYY/MM/DD`
|
703
|
+
# help: `add sick child YYYY/MM/DD`
|
704
|
+
# help: `I'm sick today`
|
705
|
+
# help: `I'm on vacation today`
|
706
|
+
# help: It will add the supplied period to your plan.
|
707
|
+
# help: Instead of YYYY/MM/DD you can use 'today' or 'tomorrow' or 'next week'
|
708
|
+
# help: To see your plan call `see my time off`
|
709
|
+
# help: If you want to see the vacation plan for the team `see team NAME`
|
710
|
+
# help: Also you can see the vacation plan for the team for a specific period: `vacations team NAME YYYY/MM/DD`
|
711
|
+
# help: The SmartBot will automatically set the users status to :palm_tree:, :baby: or :face_with_thermometer: and the expiration date.
|
712
|
+
# help: Examples:
|
713
|
+
# help: _add vacation from 2022/10/01 to 2022/10/22_
|
714
|
+
# help: _add sick 2022/08/22_
|
715
|
+
# help: _add vacation tomorrow_
|
716
|
+
# help: _I'll be on vacation next week_
|
717
|
+
# help: _add sick baby today_
|
718
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#time-off-management|more info>
|
719
|
+
# help: command_id: :add_vacation
|
720
|
+
# help:
|
721
|
+
when /\A\s*(add)\s+(sick|vacation|sick\s+baby|sick\s+child)\s+from\s+(\d\d\d\d\/\d\d\/\d\d)\s+to\s+(\d\d\d\d\/\d\d\/\d\d)\s*\z/i,
|
722
|
+
/\A\s*(add)\s+(sick|vacation|sick\s+baby|sick\s+child)\s+from\s+(\d\d\d\d-\d\d-\d\d)\s+to\s+(\d\d\d\d-\d\d-\d\d)\s*\z/i,
|
723
|
+
/\A\s*(add)\s+(sick|vacation|sick\s+baby|sick\s+child)\s+(\d\d\d\d-\d\d-\d\d)()\s*\z/i,
|
724
|
+
/\A\s*(add)\s+(sick|vacation|sick\s+baby|sick\s+child)\s+(\d\d\d\d\/\d\d\/\d\d)()\s*\z/i,
|
725
|
+
/\A\s*(add)\s+(sick|vacation|sick\s+baby|sick\s+child)\s+(today|tomorrow|next\sweek)()\s*\z/i,
|
726
|
+
/\A\s*(I'm|I\s+am|I'll\s+be|I\s+will\s+be)\s+(sick|on\s+vacation)\s+(today|tomorrow|next\sweek)()\s*\z/i
|
727
|
+
type = $2
|
728
|
+
from = $3.downcase
|
729
|
+
to = $4
|
730
|
+
type = "vacation" if type.match?(/vacation/)
|
731
|
+
add_vacation(user, type, from, to)
|
732
|
+
|
733
|
+
# help: ----------------------------------------------
|
734
|
+
# help: `remove vacation ID`
|
735
|
+
# help: `remove vacation period ID`
|
736
|
+
# help: `remove sick period ID`
|
737
|
+
# help: `remove time off period ID`
|
738
|
+
# help: `delete vacation ID`
|
739
|
+
# help: It will remove the specified period from your vacations/sick periods.
|
740
|
+
# help: Examples:
|
741
|
+
# help: _remove vacation 20_
|
742
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#time-off-management|more info>
|
743
|
+
# help: command_id: :remove_vacation
|
744
|
+
# help:
|
745
|
+
when /\A\s*(delete|remove)\s+(vacation|sick|time\s+off)(\s+period)?\s+(\d+)\s*\z/i
|
746
|
+
vacation_id = $4.to_i
|
747
|
+
remove_vacation(user, vacation_id)
|
748
|
+
|
749
|
+
# help: ----------------------------------------------
|
750
|
+
# help: `see my vacations`
|
751
|
+
# help: `see my time off`
|
752
|
+
# help: `see vacations @USER`
|
753
|
+
# help: `see my vacations YEAR`
|
754
|
+
# help: `time off`
|
755
|
+
# help: It will display current and past time off.
|
756
|
+
# help: If you call this command on a DM, it will show your vacations for the year on a calendar.
|
757
|
+
# help: see: (optional)
|
758
|
+
# help: Examples:
|
759
|
+
# help: _see my vacations_
|
760
|
+
# help: _see my time off 2022_
|
761
|
+
# help: _see vacations @john_
|
762
|
+
# help: _time off 2023_
|
763
|
+
# help: _time off @johan 2024_
|
764
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#time-off-management|more info>
|
765
|
+
# help: command_id: :see_vacations
|
766
|
+
# help:
|
767
|
+
when /\A\s*(see\s+)?(my\s+)?vacations\s*()\s*(\d{4})?\s*\z/i,
|
768
|
+
/\A\s*(see\s+)?(my\s+)?time\s*off\s*()\s*(\d{4})?\s*\z/i,
|
769
|
+
/\A\s*(see\s+)()?time\s*off\s+<@(\w+)>\s*\s*(\d{4})?\s*\z/i,
|
770
|
+
/\A\s*(see\s+)()?vacations\s+<@(\w+)>\s*(\d{4})?\s*\z/i
|
771
|
+
from_user = $3
|
772
|
+
year = $4
|
773
|
+
react :running
|
774
|
+
see_vacations(user, dest, from_user: from_user, year: year)
|
775
|
+
unreact :running
|
776
|
+
|
777
|
+
# help: ----------------------------------------------
|
778
|
+
# help: `vacations team NAME`
|
779
|
+
# help: `time off team NAME`
|
780
|
+
# help: `vacations team NAME YYYY/MM/DD`
|
781
|
+
# help: `time off team NAME YYYY/MM/DD`
|
782
|
+
# help: It will display the time off plan for the team specified.
|
783
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#time-off-management|more info>
|
784
|
+
# help: command_id: :see_vacations_team
|
785
|
+
# help:
|
786
|
+
|
787
|
+
# help: ----------------------------------------------
|
788
|
+
# help: `public holidays COUNTRY`
|
789
|
+
# help: `public holidays COUNTRY/STATE DATE`
|
790
|
+
# help: `calendar COUNTRY`
|
791
|
+
# help: `calendar COUNTRY/STATE DATE`
|
792
|
+
# help: It will display the public holidays for the country specified.
|
793
|
+
# help: If calendar then it will show the calendar for the country specified.
|
794
|
+
# help: STATE: optional. If not specified, it will return all the holidays for the country.
|
795
|
+
# help: DATE: optional. It can be supplied as YYYY or YYYY-MM or YYYY-MM-DD. If not specified, it will return all the holidays for current year.
|
796
|
+
# help: Examples:
|
797
|
+
# help: _public holidays United States_
|
798
|
+
# help: _public holidays United States/California_
|
799
|
+
# help: _public holidays United States/California 2023_
|
800
|
+
# help: _public holidays Iceland 2023-12_
|
801
|
+
# help: _public holidays India 2023-12-25_
|
802
|
+
# help: _calendar United States/California_
|
803
|
+
# help: command_id: :public_holidays
|
804
|
+
# help: command_id: :calendar_country
|
805
|
+
# help:
|
806
|
+
when /\A\s*(public\s+)?(holiday?|vacation|calendar)s?\s+(in\s+|on\s+)?([a-zA-Z\s]+)()()()()\s*\z/i,
|
807
|
+
/\A\s*(public\s+)?(holiday?|vacation|calendar)s?\s+(in\s+|on\s+)?([a-zA-Z\s]+)\/([a-zA-Z\s]+)()()()\s*\z/i,
|
808
|
+
/\A\s*(public\s+)?(holiday?|vacation|calendar)s?\s+(in\s+|on\s+)?([a-zA-Z\s]+)\/([a-zA-Z\s]+)\s+(\d{4})[\/\-]?(\d\d)?[\/\-]?(\d\d)?\s*\z/i,
|
809
|
+
/\A\s*(public\s+)?(holiday?|vacation|calendar)s?\s+(in\s+|on\s+)?([a-zA-Z\s]+)()\s+(\d{4})[\/\-]?(\d\d)?[\/\-]?(\d\d)?\s*\z/i
|
810
|
+
type = $2.downcase
|
811
|
+
country = $4
|
812
|
+
state = $5.to_s
|
813
|
+
year = $6.to_s
|
814
|
+
month = $7.to_s
|
815
|
+
day = $8.to_s
|
816
|
+
year = Date.today.year if year.to_s == ""
|
817
|
+
if type == "calendar"
|
818
|
+
save_stats :calendar_country
|
819
|
+
state = "/#{state.downcase}" if state.to_s != ""
|
820
|
+
display_calendar("", year, country_region: "#{country.downcase}#{state}")
|
821
|
+
else
|
822
|
+
public_holidays(country, state, year, month, day)
|
823
|
+
end
|
824
|
+
|
825
|
+
# help: ----------------------------------------------
|
826
|
+
# help: `set public holidays to COUNTRY/STATE`
|
827
|
+
# help: It will set the public holidays for the country and state specified.
|
828
|
+
# help: If STATE is not specified, it will set the public holidays for the country.
|
829
|
+
# help: Examples:
|
830
|
+
# help: _set public holidays to Iceland_
|
831
|
+
# help: _set public holidays to United States/California_
|
832
|
+
# help: command_id: :set_public_holidays
|
833
|
+
# help:
|
834
|
+
when /\A\s*set\s+public\s+(holiday?|vacation)s?\s+to\s+([^\/]+)\/([^\/]+)\s*\z/i,
|
835
|
+
/\A\s*set\s+public\s+(holiday?|vacation)s?\s+to\s+([^\/]+)\s*\z/i
|
836
|
+
country = $2
|
837
|
+
state = $3.to_s
|
838
|
+
set_public_holidays(country, state, user)
|
839
|
+
|
840
|
+
# help: ----------------------------------------------
|
841
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#personal-settings|PERSONAL SETTINGS>*
|
842
|
+
# help: `set personal settings SETTINGS_ID VALUE`
|
843
|
+
# help: `delete personal settings SETTINGS_ID`
|
844
|
+
# help: `get personal settings SETTINGS_ID`
|
845
|
+
# help: `get personal settings`
|
846
|
+
# help: It will set/delete/get the personal settings supplied for the user.
|
847
|
+
# help: Examples:
|
848
|
+
# help: _set personal settings ai.open_ai.access_token Xd33-343sAAddd42-3JJkjC0_
|
849
|
+
# help: command_id: :set_personal_settings
|
850
|
+
# help: command_id: :delete_personal_settings
|
851
|
+
# help: command_id: :get_personal_settings
|
852
|
+
# help:
|
853
|
+
when /\A\s*(set)\s+personal\s+(setting|config)s?\s+([\w\.]+)(\s*=?\s*)(.+)\s*\z/i,
|
854
|
+
/\A\s*(delete|get)\s+personal\s+(setting|config)s?\s+([\w\.]+)()()\s*\z/i,
|
855
|
+
/\A\s*(get)\s+personal\s+(setting|config)s?()()()\s*\z/i
|
856
|
+
settings_type = $1.downcase.to_sym
|
857
|
+
settings_id = $3.downcase
|
858
|
+
settings_value = $5.to_s
|
859
|
+
personal_settings(user, settings_type, settings_id, settings_value)
|
827
860
|
|
828
861
|
# help: ----------------------------------------------
|
862
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#openai|OpenAI>*
|
829
863
|
# help: `?w`
|
830
864
|
# help: `?w PROMPT`
|
831
865
|
# help: OpenAI: It will transcribe the audio file attached and performed the PROMPT indicated if supplied.
|
832
866
|
# help: Examples:
|
833
867
|
# help: _?w_
|
834
868
|
# help: _?w translate to spanish_
|
835
|
-
# help: _?w
|
836
|
-
# help: _?w translate to english and
|
869
|
+
# help: _?w what is this about?_
|
870
|
+
# help: _?w translate to english and tell me what is about_
|
837
871
|
# help: command_id: :open_ai_whisper
|
838
872
|
# help:
|
839
|
-
|
840
|
-
|
841
|
-
|
873
|
+
when /\A\s*\?w()\s*\z/im, /\A\s*\?w\s+(.+)\s*\z/im
|
874
|
+
message = $1.to_s.downcase
|
875
|
+
open_ai_whisper(message, files)
|
842
876
|
|
843
877
|
# help: ----------------------------------------------
|
844
878
|
# help: `?m`
|
845
879
|
# help: `?m MODEL`
|
880
|
+
# help: `chatgpt models`
|
881
|
+
# help: `?m chatgpt`
|
846
882
|
# help: OpenAI: It will return the list of models available or the details of the model indicated.
|
883
|
+
# help: If chatgpt models is used, it will return the list of chatgpt models available.
|
847
884
|
# help: Examples:
|
848
885
|
# help: _?m_
|
849
886
|
# help: _?m gpt-3.5-turbo_
|
887
|
+
# help: _chatgpt models_
|
850
888
|
# help: command_id: :open_ai_models
|
851
889
|
# help:
|
852
|
-
|
853
|
-
|
854
|
-
|
890
|
+
when /\A\s*\?m()\s*\z/im, /\A\s*\?m\s+(.+)\s*\z/im, /\A\s*(chatgpt)\s+models\s*\z/im
|
891
|
+
model = $1.to_s.downcase
|
892
|
+
open_ai_models(model)
|
855
893
|
|
856
894
|
# help: ----------------------------------------------
|
857
895
|
# help: `??i PROMPT`
|
@@ -860,7 +898,7 @@ class SlackSmartBot
|
|
860
898
|
# help: `?iv`
|
861
899
|
# help: `?ivNUMBER`
|
862
900
|
# help: `?ie PROMPT`
|
863
|
-
# help: OpenAI: i PROMPT -> It will generate an image based on the PROMPT indicated.
|
901
|
+
# help: OpenAI: i PROMPT -> It will generate an image based on the PROMPT indicated.
|
864
902
|
# help: If ??i is used, it will start from zero the session. If not all the previous prompts from the session will be used to generate the image.
|
865
903
|
# help: OpenAI: ir -> It will generate a new image using the session prompts.
|
866
904
|
# help: OpenAI: iv -> It will generate a variation of the last image generated.
|
@@ -878,43 +916,323 @@ class SlackSmartBot
|
|
878
916
|
# help: command_id: :open_ai_variations_image
|
879
917
|
# help: command_id: :open_ai_edit_image
|
880
918
|
# help:
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
919
|
+
when /\A\s*()\?i()\s\s*(.+)\s*\z/im, /\A\s*(\?\?)i()\s\s*(.+)\s*\z/im, /\A\s*()\?i(r)()\s*\z/im,
|
920
|
+
/\A\s*()\?i(v)()\s*\z/im, /\A\s*()\?i(v\d+)()\s*\z/im,
|
921
|
+
/\A\s*()\?i(e)\s+(.+)\s*\z/im,
|
922
|
+
/\A\s*()\?i(e)()\s*\z/im,
|
923
|
+
/\A\s*(\?\?)i()()\s*\z/im
|
924
|
+
delete_history = $1.to_s != ""
|
925
|
+
image_opt = $2.to_s.downcase
|
926
|
+
message = $3.to_s
|
927
|
+
if image_opt == "" or image_opt == "r"
|
928
|
+
open_ai_generate_image(message, delete_history, repeat: image_opt == "r")
|
929
|
+
elsif image_opt.match?(/v\d*/i)
|
930
|
+
variations = image_opt.match(/v(\d*)/i)[1].to_i
|
931
|
+
open_ai_variations_image(message, variations, files)
|
932
|
+
elsif image_opt == "e"
|
933
|
+
open_ai_edit_image(message, files)
|
934
|
+
end
|
935
|
+
|
898
936
|
# help: ----------------------------------------------
|
899
|
-
# help: `??`
|
900
937
|
# help: `?? PROMPT`
|
901
938
|
# help: `? PROMPT`
|
939
|
+
# help: `?? use model MODEL_NAME`
|
940
|
+
# help: `chatGPT SESSION_NAME`
|
941
|
+
# help: `chatGPT SESSION_NAME "DESCRIPTION"`
|
942
|
+
# help: `chatGPT SESSION_NAME >TAG_NAME`
|
943
|
+
# help: `chatGPT SESSION_NAME >TAG_NAME "DESCRIPTION"`
|
944
|
+
# help: `chatGPT SESSION_NAME MODEL_NAME`
|
945
|
+
# help: `chatGPT SESSION_NAME MODEL_NAME >TAG_NAME`
|
946
|
+
# help: `chatGPT SESSION_NAME MODEL_NAME "DESCRIPTION"`
|
947
|
+
# help: `chatGPT SESSION_NAME MODEL_NAME >TAG_NAME "DESCRIPTION"`
|
902
948
|
# help: OpenAI: Chat GPT will generate a response based on the PROMPT indicated.
|
903
|
-
# help:
|
949
|
+
# help: SESSION_NAME: is the name of the session to use. Only a-Z, 0-9, hyphens, and underscore are allowed.
|
950
|
+
# help: When using 'chatGPT SESSION_NAME' in case the name doesn't exist it will create a new session with the name indicated, if exists it will continue the session.
|
951
|
+
# help: When starting a new session, if you ask SmartBot to answer on a Thread by using !! or ^, then it won't be necessary to send ? before the prompt.
|
952
|
+
# help: In this case, every single message you send will be considered a prompt to be treated.
|
953
|
+
# help: After 30 minutes of inactivity SmartBot will stop listening to the thread. You will need to continue the session after that.
|
954
|
+
# help: If you want to avoid a message to be treated then start it with a hyphen '-'.
|
955
|
+
# help: To add a collaborator when on a thread, you can use directly `add collaborator @USER`
|
956
|
+
# help: To change the model when on a thread, you can use directly `use model MODEL_NAME`
|
957
|
+
# help: If ?? is used, it will start from zero the temporary session. If not all the previous prompts from the session will be used to generate the response.
|
904
958
|
# help: You can share a message and use it as input for the supplied PROMPT.
|
959
|
+
# help: If you include in the prompt !URL then it will download and use the content of the URL as input for the prompt.
|
960
|
+
# help: MODEL_NAME can be a substring of the model name, SmartBot will search the model name that contains the substring supplied.
|
961
|
+
# help: When "DESCRIPTION" is used it will be used as a description for the session.
|
962
|
+
# help: If a previous DESCRIPTION for the session exists it will be replaced.
|
963
|
+
# help: When >TAG_NAME is used it will be used as a tag for the session.
|
964
|
+
# help: If a previous TAG_NAME for the session exists it will be replaced.
|
965
|
+
# help: Then you can list sessions by TAG_NAME, for example: `chatGPT sessions >dev`, `chatGPT public sessions >test`
|
905
966
|
# help: Examples:
|
906
|
-
# help: _??_
|
907
967
|
# help: _?? How much is two plus two_
|
908
968
|
# help: _? multiply it by pi number_
|
969
|
+
# help: _^chatgpt SpanishTeacher_
|
970
|
+
# help: _!!chatgpt data_analyst gpt-3.5-turbo_
|
971
|
+
# help: _^chatgpt SpanishTeacher "I will teach you Spanish"_
|
972
|
+
# help: _^chatgpt SpanishTeacher gpt-3.5-turbo "I will teach you Spanish"_
|
973
|
+
# help: _^chatgpt SpanishTeacher 32k >dev "I will teach you Spanish"_
|
974
|
+
# help: _^chatgpt data_analyst >science_
|
909
975
|
# help: command_id: :open_ai_chat
|
976
|
+
# help: command_id: :open_ai_chat_add_collaborator
|
977
|
+
# help: command_id: :open_ai_chat_use_model
|
978
|
+
# help:
|
979
|
+
|
980
|
+
# help: ----------------------------------------------
|
981
|
+
# help: `chatGPT get SESSION_NAME`
|
982
|
+
# help: `??g SESSION_NAME`
|
983
|
+
# help: OpenAI: SmartBot will get all the prompts from the ChatGPT session indicated.
|
984
|
+
# help: Examples:
|
985
|
+
# help: _chatgpt get SpanishTeacher_
|
986
|
+
# help: _??g SpanishTeacher_
|
987
|
+
# help: command_id: :open_ai_chat_get_prompts
|
910
988
|
# help:
|
911
|
-
when /\A\s*(\?\?)\s*()\z/im, /\A\s*(\?\?)\s*(.+)\s*\z/im, /\A\s*()\?\s*(.+)\s*\z/im
|
912
|
-
delete_history = $1.to_s != ''
|
913
|
-
message = $2.to_s
|
914
|
-
#@logger.info "data: #{data}" #Jal
|
915
|
-
open_ai_chat(message, delete_history)
|
916
989
|
|
917
|
-
|
990
|
+
# help: ----------------------------------------------
|
991
|
+
# help: `chatGPT delete SESSION_NAME`
|
992
|
+
# help: `??d SESSION_NAME`
|
993
|
+
# help: OpenAI: SmartBot will delete the ChatGPT session indicated.
|
994
|
+
# help: Examples:
|
995
|
+
# help: _chatgpt delete SpanishTeacher_
|
996
|
+
# help: _??d SpanishTeacher_
|
997
|
+
# help: command_id: :open_ai_chat_delete_session
|
998
|
+
# help:
|
999
|
+
|
1000
|
+
# help: ----------------------------------------------
|
1001
|
+
# help: `chatGPT share SESSION_NAME`
|
1002
|
+
# help: `chatGPT share SESSION_NAME #CHANNEL`
|
1003
|
+
# help: `chatGPT stop sharing SESSION_NAME`
|
1004
|
+
# help: `chatGPT stop sharing SESSION_NAME #CHANNEL`
|
1005
|
+
# help: OpenAI: It will share your ChatGPT session with everyone in your workspace if no channel supplied.
|
1006
|
+
# help: If channel supplied it will be shared with that channel.
|
1007
|
+
# help: If 'stop sharing' is used it will stop sharing the session.
|
1008
|
+
# help: Examples:
|
1009
|
+
# help: _chatgpt share SpanishTeacher_
|
1010
|
+
# help: _chatgpt share SpanishTeacher #sales_
|
1011
|
+
# help: _chatgpt stop sharing SpanishTeacher_
|
1012
|
+
# help: _chatgpt stop sharing SpanishTeacher #sales_
|
1013
|
+
# help: command_id: :open_ai_chat_share_session
|
1014
|
+
# help:
|
1015
|
+
|
1016
|
+
# help: ----------------------------------------------
|
1017
|
+
# help: `chatGPT sessions`
|
1018
|
+
# help: `chatGPT public sessions`
|
1019
|
+
# help: `chatGPT shared sessions`
|
1020
|
+
# help: `chatGPT sessions >TAG_NAME`
|
1021
|
+
# help: `chatGPT public sessions >TAG_NAME`
|
1022
|
+
# help: `chatGPT shared sessions >TAG_NAME`
|
1023
|
+
# help: `??l`
|
1024
|
+
# help: OpenAI: SmartBot will list the ChatGPT sessions.
|
1025
|
+
# help: 'sessions' will list the sessions you have created.
|
1026
|
+
# help: If 'public sessions' is used it will list the public sessions.
|
1027
|
+
# help: If 'shared sessions' is used it will list the shared sessions on the channel.
|
1028
|
+
# help: If TAG_NAME is supplied it will list the sessions with that tag.
|
1029
|
+
# help: Examples:
|
1030
|
+
# help: _chatgpt sessions_
|
1031
|
+
# help: _chatgpt public sessions_
|
1032
|
+
# help: _chatgpt shared sessions >testing_
|
1033
|
+
# help: _chatgpt sessions >dev_
|
1034
|
+
# help: command_id: :open_ai_chat_list_sessions
|
1035
|
+
# help:
|
1036
|
+
|
1037
|
+
# help: ----------------------------------------------
|
1038
|
+
# help: `chatGPT copy SESSION_NAME`
|
1039
|
+
# help: `chatGPT copy SESSION_NAME NEW_SESSION_NAME`
|
1040
|
+
# help: `chatGPT copy temporary session NEW_SESSION_NAME`
|
1041
|
+
# help: `chatGPT use USER_NAME SESSION_NAME`
|
1042
|
+
# help: `chatGPT use USER_NAME SESSION_NAME NEW_SESSION_NAME`
|
1043
|
+
# help: OpenAI: SmartBot will copy the ChatGPT session indicated.
|
1044
|
+
# help: If NEW_SESSION_NAME is supplied it will be used as the name for the new session.
|
1045
|
+
# help: If USER_NAME is supplied it will copy the session from that user on shared sessions.
|
1046
|
+
# help: In case no NEW_SESSION_NAME is supplied it will use the same name as the original session plus a number.
|
1047
|
+
# help: Examples:
|
1048
|
+
# help: _chatgpt copy SpanishTeacher_
|
1049
|
+
# help: _chatgpt copy SpanishTeacher spanish_lessons_
|
1050
|
+
# help: _chatgpt use peterw SpanishTeacher_
|
1051
|
+
# help: _chatgpt use susanssd dataAnalysis DataSales_
|
1052
|
+
# help: command_id: :open_ai_chat_copy_session
|
1053
|
+
# help: command_id: :open_ai_chat_copy_session_from_user
|
1054
|
+
# help:
|
1055
|
+
|
1056
|
+
#chatgpt get
|
1057
|
+
when /\A\s*\?\?(g)\s+([\w\-0-9]+)()\s*\z/im,
|
1058
|
+
/\A\s*chatgpt\s+(get)\s+([\w\-0-9]+)()\s*\z/im
|
1059
|
+
session_name = $2.to_s
|
1060
|
+
open_ai_chat_get_prompts(session_name)
|
1061
|
+
|
1062
|
+
#chatgpt delete
|
1063
|
+
when /\A\s*\?\?(d)\s+([\w\-0-9]+)()\s*\z/im,
|
1064
|
+
/\A\s*chatgpt\s+(delete)\s+([\w\-0-9]+)()\s*\z/im
|
1065
|
+
session_name = $2.to_s
|
1066
|
+
open_ai_chat_delete_session(session_name)
|
1067
|
+
|
1068
|
+
#chatgpt share
|
1069
|
+
when /\A\s*chatgpt\s+(share)\s+([\w\-0-9]+)\s+(on\s+|in\s+)?<#(\w+)\|.*>\s*\z/im,
|
1070
|
+
/\A\s*chatgpt\s+(share)\s+([\w\-0-9]+)()()\s*\z/im,
|
1071
|
+
/\A\s*chatgpt\s+(stop)\s+sharing\s+([\w\-0-9]+)\s+(on\s+|in\s+)?<#(\w+)\|.*>\s*\z/im,
|
1072
|
+
/\A\s*chatgpt\s+(stop)\s+sharing\s+([\w\-0-9]+)()()\s*\z/im
|
1073
|
+
type = $1.to_s.downcase.to_sym
|
1074
|
+
session_name = $2.to_s
|
1075
|
+
channel_id = $4.to_s
|
1076
|
+
open_ai_chat_share_session(type, session_name, channel_id)
|
1077
|
+
|
1078
|
+
#chatgpt list
|
1079
|
+
when /\A\s*chatgpt\s+(list\s+)?sessions()()\s*\z/im,
|
1080
|
+
/\A\s*chatgpt\s+(list\s+)?sessions()\s+>([\w\-0-9]+)\s*\z/im,
|
1081
|
+
/\A\s*chatgpt\s+(list\s+)?()>([\w\-0-9]+)\s+sessions\s*\z/im,
|
1082
|
+
/\A\s*chatgpt\s+(list\s+)?(public)\s+sessions()\s*\z/im,
|
1083
|
+
/\A\s*chatgpt\s+(list\s+)?(public)\s+sessions\s+>([\w\-0-9]+)\s*\z/im,
|
1084
|
+
/\A\s*chatgpt\s+(list\s+)?(public)\s+>([\w\-0-9]+)\s+sessions\s*\z/im,
|
1085
|
+
/\A\s*chatgpt\s+(list\s+)?(shared)\s+sessions()\s*\z/im,
|
1086
|
+
/\A\s*chatgpt\s+(list\s+)?(shared)\s+sessions\s+>([\w\-0-9]+)\s*\z/im,
|
1087
|
+
/\A\s*chatgpt\s+(list\s+)?(shared)\s+>([\w\-0-9]+)\s+sessions\s*\z/im,
|
1088
|
+
/\A\s*\?\?l\s*\z()()/im,
|
1089
|
+
/\A\s*\?\?l\s*\z()\s+>([\w\-0-9]+)/im
|
1090
|
+
type = $2.to_s.downcase.to_sym
|
1091
|
+
tag = $3.to_s.downcase
|
1092
|
+
type = :own if type.to_s == ""
|
1093
|
+
open_ai_chat_list_sessions(type, tag: tag)
|
1094
|
+
|
1095
|
+
#chatgpt copy
|
1096
|
+
when /\A\s*chatgpt\s+copy\s+temporary\s+session\s+()([\w\-0-9]+)\s*\z/im,
|
1097
|
+
/\A\s*chatgpt\s+copy\s+([\w\-0-9]+)()\s*\z/im,
|
1098
|
+
/\A\s*chatgpt\s+copy\s+([\w\-0-9]+)\s+([\w\-0-9]+)\s*\z/im
|
1099
|
+
session_name = $1.to_s
|
1100
|
+
new_session_name = $2.to_s
|
1101
|
+
open_ai_chat_copy_session("", "", session_name, new_session_name)
|
1102
|
+
|
1103
|
+
#chatgpt use session
|
1104
|
+
when /\A\s*chatgpt\s+use\s+([\w\-0-9]+)\s+([\w\-0-9]+)()\s*\z/im,
|
1105
|
+
/\A\s*chatgpt\s+use\s+([\w\-0-9]+)\s+([\w\-0-9]+)\s+([\w\-0-9]+)\s*\z/im
|
1106
|
+
user_name = $1.to_s
|
1107
|
+
session_name = $2.to_s
|
1108
|
+
new_session_name = $3.to_s
|
1109
|
+
#if user_name include the team_id + "_" in the begining then assign to user_team_id and remove it from user_name
|
1110
|
+
if user_name.match?(/\A[A-Z0-9]{7,11}_/)
|
1111
|
+
user_team_id = user_name.match(/\A([A-Z0-9]{7,11})_/)[1]
|
1112
|
+
user_name = user_name.gsub(/\A[A-Z0-9]{7,11}_/, "")
|
1113
|
+
else
|
1114
|
+
user_team_id = ""
|
1115
|
+
end
|
1116
|
+
open_ai_chat_copy_session(user_team_id, user_name, session_name, new_session_name)
|
1117
|
+
|
1118
|
+
# chatgpt chat
|
1119
|
+
when /\A\s*\?\s+(add\s+collaborator)\s+<@(\w+)>()()()\s*\z/im,
|
1120
|
+
/\A\s*\?\s+(use)\s+model\s+()([\w\-0-9\.]+)()()\s*\z/im,
|
1121
|
+
/\A\s*(\?\?)()\s+use\s+model\s+([\w\-0-9\.]+)()()\s*\z/im,
|
1122
|
+
/\A\s*\?\?(s|c)\s+([\w\-0-9]+)()()()\s*\z/im,
|
1123
|
+
/\A\s*chatgpt\s+(start|continue|load)\s+([\w\-0-9]+)()()()\s*\z/im,
|
1124
|
+
/\A\s*(chatgpt)\s+([\w\-0-9]+)()()()\s*\z/im, #chatgpt session_name
|
1125
|
+
/\A\s*(chatgpt)\s+([\w\-0-9]+)()\s+>([\w\-0-9]+)()\s*\z/im, #chatgpt session_name >tag_name
|
1126
|
+
/\A\s*(chatgpt)\s+([\w\-0-9]+)\s+([\w\-0-9\.]+)()()\s*\z/im, #chatgpt session_name model_name
|
1127
|
+
/\A\s*(chatgpt)\s+([\w\-0-9]+)\s+([\w\-0-9\.]+)\s+>([\w\-0-9\.]+)()\s*\z/im, #chatgpt session_name model_name >tag_name
|
1128
|
+
/\A\s*(chatgpt)\s+([\w\-0-9]+)()\s+>([\w\-0-9]+)\s+(".+")\s*\z/im, #chatgpt session_name >tag_name "description"
|
1129
|
+
/\A\s*(chatgpt)\s+([\w\-0-9]+)()()\s+(".+")\s*\z/im, #chatgpt session_name "description"
|
1130
|
+
/\A\s*(chatgpt)\s+([\w\-0-9]+)()\s+>([\w\-0-9]+)\s+(".+")\s*\z/im, #chatgpt session_name >tag_name "description"
|
1131
|
+
/\A\s*(chatgpt)\s+([\w\-0-9]+)\s+([\w\-0-9\.]+)()\s+(".+")\s*\z/im, #chatgpt session_name model_name "description"
|
1132
|
+
/\A\s*(chatgpt)\s+([\w\-0-9]+)\s+([\w\-0-9\.]+)\s+>([\w\-0-9]+)\s+(".+")\s*\z/im, #chatgpt session_name model_name >tag_name "description"
|
1133
|
+
/\A\s*(\?\?)\s*()()()()\z/im, /\A\s*(\?\?)\s*(.+)()\s*()()\z/im, /\A\s*()\?\s*(.+)()\s*()()\z/im
|
1134
|
+
type = $1.to_s.downcase
|
1135
|
+
text = $2.to_s
|
1136
|
+
model = $3.to_s
|
1137
|
+
tag = $4.to_s
|
1138
|
+
description = $5.to_s
|
1139
|
+
delete_history = type == "??"
|
1140
|
+
type.strip!
|
1141
|
+
if type == "s" or type == "start" or type == "chatgpt"
|
1142
|
+
type = :start
|
1143
|
+
elsif type == "c" or type == "continue" or type == "load"
|
1144
|
+
type = :continue
|
1145
|
+
elsif type.match?(/add\s+collaborator/)
|
1146
|
+
type = :add_collaborator
|
1147
|
+
elsif type == "use"
|
1148
|
+
type = :use_model
|
1149
|
+
else
|
1150
|
+
type = :temporary
|
1151
|
+
if text == "??"
|
1152
|
+
delete_history = true
|
1153
|
+
text = ""
|
1154
|
+
end
|
1155
|
+
end
|
1156
|
+
if type == :add_collaborator
|
1157
|
+
open_ai_chat_add_collaborator(text)
|
1158
|
+
elsif type == :use_model
|
1159
|
+
open_ai_chat_use_model(model)
|
1160
|
+
else
|
1161
|
+
open_ai_chat(text, delete_history, type, model: model, tag: tag, description: description, files: files)
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
# help: ----------------------------------------------
|
1165
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#recap|RECAP>*
|
1166
|
+
# help: `recap`
|
1167
|
+
# help: `my recap`
|
1168
|
+
# help: `recap from YYYY/MM/DD`
|
1169
|
+
# help: `recap from YYYY/MM/DD to YYYY/MM/DD`
|
1170
|
+
# help: `recap YYYY`
|
1171
|
+
# help: `recap #CHANNEL`
|
1172
|
+
# help: `my recap #CHANNEL`
|
1173
|
+
# help: `recap from YYYY/MM/DD #CHANNEL`
|
1174
|
+
# help: `recap from YYYY/MM/DD to YYYY/MM/DD #CHANNEL`
|
1175
|
+
# help: `recap YYYY #CHANNEL`
|
1176
|
+
# help: It will show a recap of the channel. If channel not supplied, it will show the recap of the current channel
|
1177
|
+
# help: If 'my' is added, it will show also a recap of your messages
|
1178
|
+
# help: If only one date is added, it will show the recap from that day to 31st of December of that year
|
1179
|
+
# help: If only one year is added, it will show the recap from 1st of January to 31st of December of that year
|
1180
|
+
# help: Examples:
|
1181
|
+
# help: _recap_
|
1182
|
+
# help: _my recap_
|
1183
|
+
# help: _recap 2022_
|
1184
|
+
# help: _my recap from 2023/07/01 to 2023/12/31_
|
1185
|
+
# help: _recap from 2023/07/01 to 2023/12/31 #sales_
|
1186
|
+
# help: _my recap from 2023/07/01 #sales_
|
1187
|
+
# help: _recap 2023 #sales_
|
1188
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#recap|more info>
|
1189
|
+
# help: command_id: :recap
|
1190
|
+
# help:
|
1191
|
+
when /\A\s*(my\s+)?recap\s*()(\d\d\d\d)?()()()\z/i, /\A\s*(my\s+)?recap\s*()(\d\d\d\d)?()()\s*<#(\w+)\|?.*>\z/i,
|
1192
|
+
/\A\s*(my\s+)?recap\s*(from\s+)?(\d\d\d\d[\.\-\/]\d\d[\.\-\/]\d\d)\s*(to\s+)?(\d\d\d\d[\.\-\/]\d\d[\.\-\/]\d\d)?()\z/i,
|
1193
|
+
/\A\s*(my\s+)?recap\s*(from\s+)?(\d\d\d\d[\.\-\/]\d\d[\.\-\/]\d\d)\s*(to\s+)?(\d\d\d\d[\.\-\/]\d\d[\.\-\/]\d\d)?\s*<#(\w+)\|?.*>\z/i
|
1194
|
+
my_recap = $1.to_s != ""
|
1195
|
+
date_start = $3.to_s
|
1196
|
+
date_end = $5.to_s
|
1197
|
+
channel = $6.to_s
|
1198
|
+
channel = dest if channel == ""
|
1199
|
+
recap(user, dest, channel, date_start, date_end, my_recap)
|
1200
|
+
|
1201
|
+
# help: ----------------------------------------------
|
1202
|
+
# help: >*<https://github.com/MarioRuiz/slack-smart-bot#summarize|SUMMARIZE>*
|
1203
|
+
# help: `summarize`
|
1204
|
+
# help: `summarize since YYYY/MM/DD`
|
1205
|
+
# help: `summarize #CHANNEL`
|
1206
|
+
# help: `summarize #CHANNEL since YYYY/MM/DD`
|
1207
|
+
# help: `summarize URL_THREAD`
|
1208
|
+
# help: It will summarize using ChatGPT the messages in the channel since the date specified.
|
1209
|
+
# help: If no date is specified it will summarize the last 30 days.
|
1210
|
+
# help: If time off added using Time Off command it will summarize since your last time off date started.
|
1211
|
+
# help: If no channel is specified it will summarize the current channel.
|
1212
|
+
# help: If a thread URL is specified it will summarize the thread.
|
1213
|
+
# help: If the command is used in a thread it will summarize the thread.
|
1214
|
+
# help: Examples:
|
1215
|
+
# help: _summarize_
|
1216
|
+
# help: _summarize since 2024/01/22_
|
1217
|
+
# help: _summarize #sales_
|
1218
|
+
# help: _summarize #sales since 2024/01/22_
|
1219
|
+
# help: _summarize https://yourcompany.slack.com/archives/C111JG4V4DZ/p1622549264010700 _
|
1220
|
+
# help: <https://github.com/MarioRuiz/slack-smart-bot#summarize|more info>
|
1221
|
+
# help: command_id: :summarize
|
1222
|
+
# help:
|
1223
|
+
when /\A\s*summarize()()()\s*\z/i, /\A\s*summarize\s+<#\w+\|(.+)>()()\s*\z/i, /\A\s*summarize\s+<#(\w+)\|>\s*()()\z/i,
|
1224
|
+
/\A\s*summarize()\s+since\s+(\d{4}[-\/]\d{2}[-\/]\d{2})()\s*\z/i, /\A\s*summarize\s+<#\w+\|(.+)>\s+since\s+(\d{4}[-\/]\d{2}[-\/]\d{2})()\s*\z/i,
|
1225
|
+
/\A\s*summarize\s+<#(.+)\|>\s+since\s+(\d{4}[-\/]\d{2}[-\/]\d{2})()\s*\z/i,
|
1226
|
+
/\A\s*summarize\s+https:\/\/\w+\.slack\.com\/archives\/(\w+)()\/p(\d+)\s*\z/i,
|
1227
|
+
/\A\s*summarize\s+https:\/\/\w+\.slack\.com\/archives\/(\w+)()\/(\d+\.\d+)\s*\z/i
|
1228
|
+
channel = $1.to_s
|
1229
|
+
from = $2.to_s
|
1230
|
+
thread_ts = $3.to_s
|
1231
|
+
channel = dest if channel == ""
|
1232
|
+
summarize(user, dest, channel, from, thread_ts)
|
1233
|
+
|
1234
|
+
# help: >*<|OTHER GENERAL COMMANDS>*
|
1235
|
+
|
918
1236
|
else
|
919
1237
|
return false
|
920
1238
|
end
|
@@ -929,4 +1247,4 @@ class SlackSmartBot
|
|
929
1247
|
return false
|
930
1248
|
end
|
931
1249
|
end
|
932
|
-
end
|
1250
|
+
end
|