slack-ruby-bot 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.rubocop_todo.yml +3 -9
  4. data/.travis.yml +6 -10
  5. data/CHANGELOG.md +9 -0
  6. data/DEPLOYMENT.md +3 -5
  7. data/Dangerfile +2 -0
  8. data/Gemfile +1 -4
  9. data/MIGRATION.md +13 -0
  10. data/README.md +50 -61
  11. data/UPGRADING.md +14 -0
  12. data/lib/slack-ruby-bot/bot.rb +1 -1
  13. data/lib/slack-ruby-bot/client.rb +22 -23
  14. data/lib/slack-ruby-bot/commands/about.rb +1 -1
  15. data/lib/slack-ruby-bot/commands/base.rb +0 -19
  16. data/lib/slack-ruby-bot/commands/help.rb +1 -1
  17. data/lib/slack-ruby-bot/commands/hi.rb +1 -1
  18. data/lib/slack-ruby-bot/commands/unknown.rb +1 -1
  19. data/lib/slack-ruby-bot/config.rb +1 -8
  20. data/lib/slack-ruby-bot/hooks/hook_support.rb +0 -6
  21. data/lib/slack-ruby-bot/hooks/message.rb +6 -17
  22. data/lib/slack-ruby-bot/rspec/support/slack-ruby-bot/respond_with_error.rb +0 -2
  23. data/lib/slack-ruby-bot/rspec/support/slack-ruby-bot/respond_with_slack_message.rb +0 -2
  24. data/lib/slack-ruby-bot/rspec/support/slack-ruby-bot/respond_with_slack_messages.rb +0 -2
  25. data/lib/slack-ruby-bot/server.rb +3 -4
  26. data/lib/slack-ruby-bot/version.rb +1 -1
  27. data/spec/slack-ruby-bot/client_spec.rb +101 -28
  28. data/spec/slack-ruby-bot/config_spec.rb +0 -57
  29. data/spec/slack-ruby-bot/hooks/hook_support_spec.rb +0 -5
  30. data/spec/slack-ruby-bot/hooks/message_spec.rb +6 -53
  31. data/spec/slack-ruby-bot/server_spec.rb +4 -16
  32. data/spec/spec_helper.rb +0 -6
  33. metadata +9 -23
  34. data/lib/initializers/giphy.rb +0 -10
  35. data/lib/initializers/giphy_client.rb +0 -41
  36. data/spec/slack-ruby-bot/commands/send_gif_spec.rb +0 -27
  37. data/spec/slack-ruby-bot/commands/send_message_with_gif_spec.rb +0 -40
  38. data/spec/slack-ruby-bot/initializers/giphy_client_spec.rb +0 -30
  39. data/spec/slack-ruby-bot/initializers/giphy_spec.rb +0 -20
  40. data/spec/support/fixtures/slack/giphy_burrito.yml +0 -69
  41. data/spec/support/fixtures/slack/giphy_client_burrito.yml +0 -71
  42. data/spec/support/fixtures/slack/giphy_client_burrito_rated_pg.yml +0 -80
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6c1329b698f67974759dd037ed5b1f5df3b69d3488c46710e15483e8d1c697a
4
- data.tar.gz: e936269d17f733b75fe5253e8895c82095839f280e65a6a76d7f209c493c99d0
3
+ metadata.gz: 9684c9f89d4dfb8fa0b6d57c65392979f40a6371bac3021d427f662e0a4c64db
4
+ data.tar.gz: 67d12056a667d6670b9f3f90c1df15f9e437a87b11a5aa438616bb3774d27b89
5
5
  SHA512:
6
- metadata.gz: ddf22b03b7f32b9c9d3d029a75f2e85188799f19940dcfb22dbc058d5cd9bbd94b3ec5fdf028c6c7b51359a2575431f60b0420182c3ca4b45bc3343b38edf01b
7
- data.tar.gz: faa773163bd32cd1523b872459b010b33b9a7f5c1ac85872a0fff33301f5527fd3cd381d210956f90cfbd4e00a8f52a509e6b35c7fb7b5b6f3228a07a39d942e
6
+ metadata.gz: a702d1e2016adf8903fa0283201e51e572663e0bafa8fd2b4ffa255764ce99779022bc653ed8dbc5888490521c6d9ebe8b24774084afb056526c62d9c4b3507c
7
+ data.tar.gz: d05e13f9c714eb5c97e1257e775126a42579cd5f41181e285aa79df54ceb0175f6138a056c4c7a89160e5ff53fa13fa53fff02a7d2f507c9c05fea0d9ef958f2
@@ -0,0 +1 @@
1
+ github: [dblock]
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-03-31 08:37:36 -0400 using RuboCop version 0.80.1.
3
+ # on 2020-06-27 10:38:47 -0400 using RuboCop version 0.80.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -11,13 +11,6 @@ Lint/DuplicateMethods:
11
11
  Exclude:
12
12
  - 'lib/slack-ruby-bot/hooks/set.rb'
13
13
 
14
- # Offense count: 2
15
- # Configuration parameters: AllowComments.
16
- Lint/SuppressedException:
17
- Exclude:
18
- - 'lib/initializers/giphy.rb'
19
- - 'lib/initializers/giphy_client.rb'
20
-
21
14
  # Offense count: 1
22
15
  # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
23
16
  # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
@@ -39,9 +32,10 @@ Style/AccessModifierDeclarations:
39
32
  Exclude:
40
33
  - 'lib/slack-ruby-bot/hooks/hook_support.rb'
41
34
 
42
- # Offense count: 3
35
+ # Offense count: 5
43
36
  Style/DoubleNegation:
44
37
  Exclude:
38
+ - 'lib/slack-ruby-bot/client.rb'
45
39
  - 'lib/slack-ruby-bot/commands/base.rb'
46
40
  - 'lib/slack-ruby-bot/config.rb'
47
41
 
@@ -7,22 +7,18 @@ matrix:
7
7
  - rvm: 2.6.5
8
8
  script:
9
9
  - bundle exec danger
10
- - rvm: 2.3.0
10
+ - rvm: 2.4.0
11
11
  env: CONCURRENCY=celluloid-io
12
- - rvm: 2.3.0
12
+ - rvm: 2.4.0
13
13
  env: CONCURRENCY=faye-websocket
14
- - rvm: 2.3.0
14
+ - rvm: 2.4.0
15
15
  env: CONCURRENCY=async-websocket
16
16
  - rvm: 2.6.5
17
- env: CONCURRENCY=celluloid-io WITH_GIPHY=true
18
- - rvm: 2.6.5
19
- env: CONCURRENCY=faye-websocket WITH_GIPHY=true
20
- - rvm: 2.6.5
21
- env: CONCURRENCY=celluloid-io WITH_GIPHY_CLIENT=true
17
+ env: CONCURRENCY=celluloid-io
22
18
  - rvm: 2.6.5
23
- env: CONCURRENCY=faye-websocket WITH_GIPHY_CLIENT=true
19
+ env: CONCURRENCY=faye-websocket
24
20
  - rvm: 2.6.5
25
- env: CONCURRENCY=async-websocket WITH_GIPHY_CLIENT=true
21
+ env: CONCURRENCY=async-websocket
26
22
  - rvm: ruby-head
27
23
  - rvm: jruby-head
28
24
  allow_failures:
@@ -1,3 +1,12 @@
1
+ ### 0.16.0 (2020/7/26)
2
+
3
+ * [#263](https://github.com/slack-ruby/slack-ruby-bot/pull/263): Removed Giphy support - [@dblock](https://github.com/dblock).
4
+ * [#260](https://github.com/slack-ruby/slack-ruby-bot/pull/260): Added a brief migration guide - [@wasabigeek](https://github.com/wasabigeek).
5
+ * [#264](https://github.com/slack-ruby/slack-ruby-bot/pull/264): Added TOC to README - [@dblock](https://github.com/dblock).
6
+ * [#265](https://github.com/slack-ruby/slack-ruby-bot/pull/265): Made `allow_bot_messages` and `allow_message_loops` available in `SlackRubyBot::Client` - [@dblock](https://github.com/dblock).
7
+ * [#266](https://github.com/slack-ruby/slack-ruby-bot/pull/266): Removed deprecated `Server#hooks` - [@dblock](https://github.com/dblock).
8
+ * [#267](https://github.com/slack-ruby/slack-ruby-bot/pull/267): Require Faraday >= 1.0 - [@dblock](https://github.com/dblock).
9
+
1
10
  ### 0.15.0 (2020/5/8)
2
11
 
3
12
  * [#258](https://github.com/slack-ruby/slack-ruby-bot/pull/258): Extract development dependencies (VCR) from shared rspec configuraion - [@dikond](https://github.com/dikond).
@@ -12,6 +12,8 @@ Once created, go to the app's Basic Info tab and grab the Client ID and Client S
12
12
 
13
13
  Alternatively, you can still [generate a legacy API token](https://api.slack.com/custom-integrations/legacy-tokens) for your app and use it for some interactions.
14
14
 
15
+ If you have a legacy API token, and would like to migrate to [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server), a brief [migration guide](MIGRATION.md) is provided.
16
+
15
17
  #### SLACK_API_TOKEN
16
18
 
17
19
  Set the SLACK_API_TOKEN environment variable using the token received above.
@@ -20,10 +22,6 @@ Set the SLACK_API_TOKEN environment variable using the token received above.
20
22
  heroku config:add SLACK_API_TOKEN=...
21
23
  ```
22
24
 
23
- #### GIPHY_API_KEY
24
-
25
- The bot replies with animated GIFs. While it's currently not necessary, you may need to set GIPHY_API_KEY in the future, see [github.com/Giphy/GiphyAPI](https://github.com/Giphy/GiphyAPI) for details.
26
-
27
25
  #### SLACK_RUBY_BOT_ALIASES
28
26
 
29
27
  Optional names for this bot.
@@ -81,7 +79,7 @@ passenger_pre_start http://example.com:80/;
81
79
  <Directory /var/www/bot/public>
82
80
  Allow from all
83
81
  Options -MultiViews
84
- Require all granted
82
+ Require all granted
85
83
  </Directory>
86
84
  </VirtualHost>
87
85
 
data/Dangerfile CHANGED
@@ -1,3 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  danger.import_dangerfile(gem: 'slack-ruby-danger')
4
+
5
+ toc.check!
data/Gemfile CHANGED
@@ -13,9 +13,6 @@ if ENV.key?('CONCURRENCY')
13
13
  end
14
14
  end
15
15
 
16
- gem 'giphy', require: false if ENV.key?('WITH_GIPHY')
17
- gem 'GiphyClient', require: false if ENV.key?('WITH_GIPHY_CLIENT')
18
-
19
16
  group :test do
20
- gem 'slack-ruby-danger', '~> 0.1.0', require: false
17
+ gem 'slack-ruby-danger', '~> 0.2.0', require: false
21
18
  end
@@ -0,0 +1,13 @@
1
+ # Migrating from Legacy API Tokens
2
+
3
+ New Slack Apps require authentication via OAuth, returning an access token that should be a drop-in replacement for `SLACK_API_TOKEN`. As of the time of writing, the tokens never expire, so you could potentially write your own OAuth flow to retrieve the access token separately.
4
+
5
+ Alternatively, you could migrate to [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server). Note that this requires more infrastructure to support the OAuth flow.
6
+
7
+ ## Migrating to slack-ruby-bot-server
8
+ 1. Setup a new `slack-ruby-bot-server` project, following the [guidelines](https://github.com/slack-ruby/slack-ruby-bot-server#run-your-own).
9
+ 2. Copy over the `SlackRubyBot::Commands::Base` or `SlackRubyBot::Bot` concrete classes from your `slack-ruby-bot` project into the new project. If you used a [sample app](https://github.com/slack-ruby/slack-ruby-bot-server/tree/master/sample_apps), copy them into the [`commands` folder](https://github.com/slack-ruby/slack-ruby-bot-server/tree/master/sample_apps/sample_app_activerecord/commands) and require it in `commands.rb`.
10
+ 3. Create a [Slack Button](https://api.slack.com/docs/slack-button), setting the redirect URL to your OAuth grant endpoint. In the sample app, this would be `<ROOT_URL>/api/teams`.
11
+ 4. Run your app and authenticate with the Slack button.
12
+
13
+ **NOTE**: By default, other teams would be able to authenticate and connect their workspaces using the same Slack button. If this is not what you want, you would need to prevent it.
data/README.md CHANGED
@@ -11,6 +11,51 @@ If you are not familiar with Slack bots or Slack API concepts, you might want to
11
11
 
12
12
  ![](slack.png)
13
13
 
14
+ # Table of Contents
15
+
16
+ - [Useful to Me?](#useful-to-me)
17
+ - [Stable Release](#stable-release)
18
+ - [Usage](#usage)
19
+ - [A Minimal Bot](#a-minimal-bot)
20
+ - [Gemfile](#gemfile)
21
+ - [pongbot.rb](#pongbotrb)
22
+ - [A Production Bot](#a-production-bot)
23
+ - [More Involved Examples](#more-involved-examples)
24
+ - [Commands and Operators](#commands-and-operators)
25
+ - [Threaded Messages](#threaded-messages)
26
+ - [Bot Aliases](#bot-aliases)
27
+ - [Generic Routing](#generic-routing)
28
+ - [Matching text in message attachments](#matching-text-in-message-attachments)
29
+ - [Providing description for your bot and commands](#providing-description-for-your-bot-and-commands)
30
+ - [Customize your command help output](#customize-your-command-help-output)
31
+ - [SlackRubyBot::Commands::Base](#slackrubybotcommandsbase)
32
+ - [Authorization](#authorization)
33
+ - [Built-In Commands](#built-in-commands)
34
+ - [[bot name]](#bot-name)
35
+ - [[bot name] hi](#bot-name-hi)
36
+ - [[bot name] help](#bot-name-help)
37
+ - [Hooks](#hooks)
38
+ - [Implementing and registering a Hook Handler](#implementing-and-registering-a-hook-handler)
39
+ - [Hooks registration on SlackRubyBot::Server initialization](#hooks-registration-on-slackrubybotserver-initialization)
40
+ - [Hooks registration on a SlackRubyBot::Server instance](#hooks-registration-on-a-slackrubybotserver-instance)
41
+ - [Hooks registration on SlackRubyBot::Server class](#hooks-registration-on-slackrubybotserver-class)
42
+ - [Bot Message Protection](#bot-message-protection)
43
+ - [Message Loop Protection](#message-loop-protection)
44
+ - [Logging](#logging)
45
+ - [Advanced Integration](#advanced-integration)
46
+ - [Proxy Configuration](#proxy-configuration)
47
+ - [Model-View-Controller Design](#model-view-controller-design)
48
+ - [Controller](#controller)
49
+ - [Model](#model)
50
+ - [View](#view)
51
+ - [Testing](#testing)
52
+ - [RSpec Shared Behaviors](#rspec-shared-behaviors)
53
+ - [Testing Lower Level Messages](#testing-lower-level-messages)
54
+ - [Useful Libraries](#useful-libraries)
55
+ - [Contributing](#contributing)
56
+ - [Upgrading](#upgrading)
57
+ - [Copyright and License](#copyright-and-license)
58
+
14
59
  ## Useful to Me?
15
60
 
16
61
  * If you are just trying to send messages to Slack, use [slack-ruby-client](https://github.com/slack-ruby/slack-ruby-client), which this library is built on top of.
@@ -19,7 +64,7 @@ If you are not familiar with Slack bots or Slack API concepts, you might want to
19
64
 
20
65
  ## Stable Release
21
66
 
22
- You're reading the documentation for the **stable** release of slack-ruby-bot, v0.15.0.
67
+ You're reading the documentation for the **stable** release of slack-ruby-bot, v0.16.0.
23
68
  See [CHANGELOG](CHANGELOG.md) for a history of changes and [UPGRADING](UPGRADING.md) for how to upgrade to more recent versions.
24
69
 
25
70
  ## Usage
@@ -141,8 +186,6 @@ SlackRubyBot.configure do |config|
141
186
  end
142
187
  ```
143
188
 
144
- This is particularly fun with emoji.
145
-
146
189
  ![](screenshots/aliases.gif)
147
190
 
148
191
  Bots will also respond to a direct message, with or without the bot name in the message itself.
@@ -320,47 +363,6 @@ class AuthorizedBot < SlackRubyBot::Commands::Base
320
363
  end
321
364
  ```
322
365
 
323
- ### Animated GIFs
324
-
325
- The `SlackRubyBot::Client` implementation comes with GIF support. To enable it add `gem GiphyClient` (official Giphy SDK) or `gem giphy` (older SDK, deprecated) to your **Gemfile** and set a Giphy key via `ENV['GIPHY_API_KEY']`. Obtain one from [developers.giphy.com](https://developers.giphy.com).
326
-
327
- **Note:** Bots send animated GIFs in default commands and errors.
328
-
329
- ```ruby
330
- class Phone < SlackRubyBot::Commands::Base
331
- command 'call'
332
-
333
- def self.call(client, data, match)
334
- client.say(channel: data.channel, text: 'called', gif: 'phone')
335
- # Sends the text 'called' and a random GIF that matches the keyword 'phone'.
336
- end
337
- end
338
- ```
339
-
340
- Giphy API key is set automatically via `ENV['GIPHY_API_KEY']`. You can override this manually.
341
-
342
- ```ruby
343
- Giphy.configure do |config|
344
- config.api_key = 'key'
345
- end
346
- ```
347
-
348
- With `GiphyClient` you can configure the default GIF [content rating](https://developers.giphy.com/docs/optional-settings#rating), which supports G, PG, PG-13, and R. The default value is `G`.
349
-
350
- ```ruby
351
- Giphy.configure do |config|
352
- config.rating = 'PG'
353
- end
354
- ```
355
-
356
- If you use giphy for something else but don't want your bots to send GIFs you can set `ENV['SLACK_RUBY_BOT_SEND_GIFS']` or `SlackRubyBot::Config.send_gifs` to `false`. The latter takes precedence.
357
-
358
- ```ruby
359
- SlackRubyBot.configure do |config|
360
- config.send_gifs = false
361
- end
362
- ```
363
-
364
366
  ### Built-In Commands
365
367
 
366
368
  Slack-ruby-bot comes with several built-in commands. You can re-define built-in commands, normally, as described above.
@@ -458,22 +460,9 @@ These will get pushed into the hook set on initialization.
458
460
 
459
461
  Either by configuration, explicit assignment or hook blocks, multiple handlers can exist for the same event type.
460
462
 
461
-
462
- #### Deprecated hook registration
463
-
464
- Registering a hook method using `hooks.add` is considered deprecated and
465
- will be removed on future versions.
466
-
467
- ```ruby
468
- # [DEPRECATED]
469
- server.hooks.add(:hello, MyBot::Hooks::UserChange.new)
470
- server.hooks.add(:hello, ->(client, data) { puts "Hello!" })
471
-
472
- ```
473
-
474
463
  ### Bot Message Protection
475
464
 
476
- By default bots do not respond to self or other bots. If you wish to change that behavior, set `allow_bot_messages` to `true`.
465
+ By default bots do not respond to self or other bots. If you wish to change that behavior globally, set `allow_bot_messages` to `true`.
477
466
 
478
467
  ```ruby
479
468
  SlackRubyBot.configure do |config|
@@ -483,7 +472,7 @@ end
483
472
 
484
473
  ### Message Loop Protection
485
474
 
486
- By default bots do not respond to their own messages. If you wish to change that behavior, set `allow_message_loops` to `true`.
475
+ By default bots do not respond to their own messages. If you wish to change that behavior globally, set `allow_message_loops` to `true`.
487
476
 
488
477
  ```ruby
489
478
  SlackRubyBot.configure do |config|
@@ -511,14 +500,14 @@ end
511
500
 
512
501
  ### Advanced Integration
513
502
 
514
- You may want to integrate a bot or multiple bots into other systems, in which case a globally configured bot may not work for you. You may create instances of [SlackRubyBot::Server](lib/slack-ruby-bot/server.rb) which accepts `token`, `aliases` and `send_gifs`.
503
+ You may want to integrate a bot or multiple bots into other systems, in which case a globally configured bot may not work for you. You may create instances of [SlackRubyBot::Server](lib/slack-ruby-bot/server.rb) which accepts `token` and `aliases`.
515
504
 
516
505
  ```ruby
517
506
  EM.run do
518
507
  bot1 = SlackRubyBot::Server.new(token: token1, aliases: ['bot1'])
519
508
  bot1.start_async
520
509
 
521
- bot2 = SlackRubyBot::Server.new(token: token2, send_gifs: false, aliases: ['bot2'])
510
+ bot2 = SlackRubyBot::Server.new(token: token2, aliases: ['bot2'])
522
511
  bot2.start_async
523
512
  end
524
513
  ```
@@ -1,6 +1,20 @@
1
1
  Upgrading SlackRubyBot
2
2
  ======================
3
3
 
4
+ ### Upgrading to >= 0.16.0
5
+
6
+ #### Removed GIF support
7
+
8
+ GIF, Giphy and other animated GIF support has been removed. Remove `gif` options from all `client.say(gif: 'keyword')` method calls, the `GIPHY_API_KEY` ENV var, `gem 'giphy'` or `gem 'GiphyClient'`, and any references to `send_gifs`. The previously deprecated `SlackRubyBot::Commands::Base#send_message`, `send_message_with_gif` and `send_gif` methods have also been removed.
9
+
10
+ See [#261](https://github.com/slack-ruby/slack-ruby-bot/issues/261) for details.
11
+
12
+ #### Removed deprecated `server.hooks`
13
+
14
+ The previously deprecated `SlackRubyBot::Server#hooks` has been removed.
15
+
16
+ See [#266](https://github.com/slack-ruby/slack-ruby-bot/issues/266) for details.
17
+
4
18
  ### Upgrading to >= 0.15.0
5
19
 
6
20
  #### Set up VCR explicitly
@@ -13,7 +13,7 @@ module SlackRubyBot
13
13
  end
14
14
 
15
15
  def self.call(client, data, _match)
16
- client.say(channel: data.channel, text: "Sorry <@#{data.user}>, I don't understand that command!", gif: 'understand')
16
+ client.say(channel: data.channel, text: "Sorry <@#{data.user}>, I don't understand that command!")
17
17
  end
18
18
  end
19
19
  end
@@ -4,12 +4,30 @@ module SlackRubyBot
4
4
  class Client < Slack::RealTime::Client
5
5
  include Loggable
6
6
  attr_accessor :aliases
7
- attr_accessor :send_gifs
7
+ attr_accessor :allow_bot_messages
8
+ attr_accessor :allow_message_loops
8
9
 
9
10
  def initialize(attrs = {})
10
11
  super(attrs)
11
12
  @aliases = attrs[:aliases]
12
- @send_gifs = attrs[:send_gifs]
13
+ @allow_message_loops = attrs[:allow_message_loops]
14
+ @allow_bot_messages = attrs[:allow_bot_messages]
15
+ end
16
+
17
+ def allow_message_loops?
18
+ @allow_message_loops.nil? ? SlackRubyBot::Config.allow_message_loops? : !!@allow_message_loops
19
+ end
20
+
21
+ def allow_bot_messages?
22
+ @allow_bot_messages.nil? ? SlackRubyBot::Config.allow_bot_messages? : !!@allow_bot_messages
23
+ end
24
+
25
+ def message_to_self?(data)
26
+ !!(self.self && self.self.id == data.user)
27
+ end
28
+
29
+ def bot_message?(data)
30
+ data.subtype == 'bot_message'
13
31
  end
14
32
 
15
33
  def names
@@ -31,12 +49,6 @@ module SlackRubyBot
31
49
  name && names.include?(name.downcase)
32
50
  end
33
51
 
34
- def send_gifs?
35
- return false unless defined?(Giphy)
36
-
37
- send_gifs.nil? ? SlackRubyBot::Config.send_gifs? : send_gifs
38
- end
39
-
40
52
  def name
41
53
  SlackRubyBot.config.user || self.self&.name
42
54
  end
@@ -46,21 +58,8 @@ module SlackRubyBot
46
58
  end
47
59
 
48
60
  def say(options = {})
49
- options = options.dup
50
- # get GIF
51
- keywords = options.delete(:gif)
52
- # text
53
- text = options.delete(:text)
54
- if keywords && send_gifs?
55
- gif = begin
56
- Giphy.random(keywords)
57
- rescue StandardError => e
58
- logger.warn "Giphy.random: #{e.message}"
59
- nil
60
- end
61
- end
62
- text = [text, gif && gif.image_url.to_s].compact.join("\n")
63
- message({ text: text }.merge(options))
61
+ logger.warn '[DEPRECATION] `gif:` is deprecated and has no effect.' if options.key?(:gif)
62
+ message({ text: '' }.merge(options))
64
63
  end
65
64
  end
66
65
  end
@@ -7,7 +7,7 @@ module SlackRubyBot
7
7
  match(/^#{bot_matcher}$/u)
8
8
 
9
9
  def self.call(client, data, _match)
10
- client.say(channel: data.channel, text: SlackRubyBot::ABOUT, gif: 'selfie')
10
+ client.say(channel: data.channel, text: SlackRubyBot::ABOUT)
11
11
  end
12
12
  end
13
13
  end
@@ -16,25 +16,6 @@ module SlackRubyBot
16
16
  SlackRubyBot::Commands::Base.command_classes << subclass
17
17
  end
18
18
 
19
- def send_message(client, channel, text, options = {})
20
- logger.warn '[DEPRECATION] `send_message` is deprecated. Please use `client.say` instead.'
21
- if text && !text.length.empty?
22
- client.say(options.merge(channel: channel, text: text))
23
- else
24
- client.say(options.merge(channel: channel, text: 'Nothing to see here.', gif: 'nothing'))
25
- end
26
- end
27
-
28
- def send_message_with_gif(client, channel, text, keywords, options = {})
29
- logger.warn '[DEPRECATION] `send_message_with_gif` is deprecated. Please use `client.say` instead.'
30
- client.say(options.merge(channel: channel, text: text, gif: keywords))
31
- end
32
-
33
- def send_gif(client, channel, keywords, options = {})
34
- logger.warn '[DEPRECATION] `send_gif` is deprecated. Please use `client.say` instead.'
35
- client.say(options.merge(channel: channel, text: '', gif: keywords))
36
- end
37
-
38
19
  def help(&block)
39
20
  Support::Help.instance.capture_help(self, &block)
40
21
  end