slackify 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d1e93f4b0ce3d49b5f99a9299b8d6a188ec05214dbd64d862270d57d1b1d676
4
- data.tar.gz: b86db43ec488d1a2bb92cbba7cb3c3daae39aca2b5ea01808d3ca60b26574ce3
3
+ metadata.gz: a9eb0e55419a369b830a072f4755238a259368914b4acfb68c6f590f87c5622f
4
+ data.tar.gz: 1504168aaae4c0b69df9d56757abf8ee44792929146aaeb78e2b8c1726b096d3
5
5
  SHA512:
6
- metadata.gz: 9d6829fab21c24bbc5af54344ff4ca1e868506ea12c2556c4013440ffff034d7a026430571285808e2d0f742c88ba548ff55680348d69974a9a0c765926a738f
7
- data.tar.gz: c5b55b8c19a0d0d24b71792292248da8da76af43ba35594448c1a5322a4b986fb7a04449982230acce954bea52fb4eee19c476ea1a8e2e68813b8272ccbc86b7
6
+ metadata.gz: 2055ad77d1a5a50f910f8371e45a13524ebb32ccacd519e35b2fc51aea82846ff986c5b5628891965efbb83d6807fc912419febff85cd46e25a7c3df22ec86da
7
+ data.tar.gz: da892b1e5f85dbe93b97649ceda4dbbc8bd6086205beb82a2b2b24554e9fc86695b78fef5d32f2e0e6331af62b02e4c781f55d4b09d00f0e0fafcfc43016d500
@@ -1,3 +1,6 @@
1
+ ##V0.1.3
2
+ Added `remove_unhandled_handler` as a configuration option to disable the unhandled handler.
3
+
1
4
  ## V0.1.2
2
5
 
3
6
  * Renaming the gem from toddlerbot to slackify.
data/README.md CHANGED
@@ -9,6 +9,7 @@ Slackify is a gem that allows to build slackbots on Rails using the [Event API](
9
9
  * [Interactive messages](#handling-interactive-messages)
10
10
  * [Slash Command](#handling-slash-commands)
11
11
  * [Custom handler for event subtypes](#custom-handler-for-event-subtypes)
12
+ * [Custom unhandled handler](#custom-unhandled-handler)
12
13
  * [Slack client](#slack-client)
13
14
  * [Sending a simple message](#sending-a-simple-message)
14
15
  * [Sending an interactive message](#sending-an-interactive-message)
@@ -96,6 +97,29 @@ Slackify.configuration.custom_event_subtype_handlers = {
96
97
 
97
98
  In this example, all events of subtype `file_share` will be sent to the `ImageHandler` class.
98
99
 
100
+ ### Custom unhandled handler
101
+
102
+ By default, the Slackify has a handler that will be called if there is no regex match for a plain text message. `Slackify::Handlers::UnhandledHandler#unhandled` is called and it replies to the user by saying "This command is not handled at the moment". You can update this in the configuration by specifying a handler class for `unhandled_handler` that responds to a class method named `unhandled`. If you do not wish to use any handler for unhandled message, you can call `remove_unhandled_handler`
103
+
104
+ ```ruby
105
+ # config/application.rb
106
+ Slackify.configure do |config|
107
+ # ...
108
+ config.unhandled_handler = MyCustomHandlerClass # enables a custom unhandled handler
109
+
110
+ config.remove_unhandled_handler # removes the unhandled_handler
111
+ end
112
+ ```
113
+
114
+ ```ruby
115
+ # app/handlers/my_custom_handler_class.rb
116
+ class MyCustomHandlerClass
117
+ def self.unhandled(params)
118
+ # ...
119
+ end
120
+ end
121
+ ```
122
+
99
123
  ## Slack client
100
124
  In order to send messages, the [slack ruby client gem](https://github.com/slack-ruby/slack-ruby-client) was used. You can send plain text messages, images and interactive messages. Since the bot was envisioned being more repsonsive than proactive, the client was made available for handlers to call using the `slack_client` method. If you wish to send messages outside of handlers, you can get the slack client by calling `Slackify.configuration.slack_client`
101
125
 
@@ -23,7 +23,7 @@ module Slackify
23
23
  @unhandled_handler = handler
24
24
  end
25
25
 
26
- def disable_unhandled_handler
26
+ def remove_unhandled_handler
27
27
  @unhandled_handler = nil
28
28
  end
29
29
 
@@ -7,7 +7,7 @@ module Slackify
7
7
  slack_client.chat_postMessage(
8
8
  as_user: true,
9
9
  channel: params[:event][:user],
10
- text: "This command is not currently handled at the moment",
10
+ text: "This command is not handled at the moment",
11
11
  )
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Leger
@@ -95,7 +95,8 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
- description: Slackbot framework for Rails using the Events API
98
+ description: Slackbot framework for Rails using the Events API. Supports events, interactive
99
+ messages and slash commands.
99
100
  email: hey@justinleger.ca
100
101
  executables: []
101
102
  extensions: []
@@ -141,5 +142,5 @@ rubyforge_project:
141
142
  rubygems_version: 2.7.3
142
143
  signing_key:
143
144
  specification_version: 4
144
- summary: Rails slackbot framework
145
+ summary: Slackbot framework for Rails using the Events API
145
146
  test_files: []