Sha256: 824f4d297b9eca665b32f2aa72bc317106843a82b84b22e79e7d1131838d7969

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

module SlackRubyBot
  module Commands
    class Base
      class << self
        alias_method :_invoke, :invoke

        def invoke(client, data)
          _invoke client, data
        rescue Mongoid::Errors::Validations => e
          logger.info "#{name.demodulize.upcase}: #{client.owner}, error - #{e.document.class}, #{e.document.errors.to_hash}"
          client.say(channel: data.channel, text: e.document.errors.first[1], gif: 'error')
          true
        rescue StandardError => e
          logger.info "#{name.demodulize.upcase}: #{client.owner}, #{e.class}: #{e}"
          client.say(channel: data.channel, text: e.message, gif: 'error')
          true
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slack-ruby-bot-server-0.1.1 lib/slack-ruby-bot-server/ext/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-0.1.0 config/initializers/slack-ruby-bot/commands/base.rb