Sha256: cc650283031f3f0ead3cab200432694def7c0ef4070abed32f173d810b97a469

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

module MessageListener

  def self.call(schema:, raw_data:)
    # Do some cool(quick returning) things here
    # schema.payload.event will be a SlackBot::Events::Schemas::Type::Message
    puts "Heya! I found a message! #{schema.payload.event.text}"
    raise StandardError, "I Randomly decided to Barf" if rand > 0.9
  end

  def self.on_success(schema)
    # Send a metric maybe?
    # Or a Log Message
    puts "Congrats! You executed it succesfully"
  end

  def self.on_failure(schema, error)
    # Send job to sidekiq to try again?
    # Or send a log message; but make sure to do it quick
    puts "Yikes, You died a misreable death"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slack_bot-events-0.4.4 examples/multi_listener/message_listener.rb