Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 1.17 KB

UPGRADING.md

File metadata and controls

64 lines (45 loc) · 1.17 KB

Upgrading SlackRubyBot

Upgrading to >= 0.4.0

This version uses slack-ruby-client instead of slack-ruby-gem.

The command interface now takes a client parameter, which is the RealTime Messaging API instance. Add the new parameter to all call calls in classes that inherit from SlackRubyBot::Commands::Base.

Before:

def self.call(data, match)
  ...
end

After:

def self.call(client, data, match)
  ...
end

This also applies to command, operator and match blocks.

Before:

command 'ping' do |data, match|
  ...
end

After:

command 'ping' do |client, data, match|
  ...
end

You can now send messages directly via the RealTime Messaging API.

client.message text: 'text', channel: 'channel'

Otherwise you must now pass the client parameter to send_message and send_message_with_gif.

def self.call(client, data, match)
  send_message client, data.channel, 'hello'
end
def self.call(client, data, match)
  send_message_with_gif client, data.channel, 'hello', 'hi'
end