Sha256: c0b3c164c42ffcf0a1fc5f31de0e7d780c00123e1a26b3b8573d191f5866e307

Contents?: true

Size: 698 Bytes

Versions: 7

Compression:

Stored size: 698 Bytes

Contents

module SlackRubyBot
  module Commands
    class Base
      class << self
        alias _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

7 entries across 7 versions & 1 rubygems

Version Path
slack-ruby-bot-server-0.6.1 lib/slack-ruby-bot-server/ext/mongoid/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-0.6.0 lib/slack-ruby-bot-server/ext/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-0.5.0 lib/slack-ruby-bot-server/ext/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-0.4.0 lib/slack-ruby-bot-server/ext/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-0.3.1 lib/slack-ruby-bot-server/ext/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-0.3.0 lib/slack-ruby-bot-server/ext/slack-ruby-bot/commands/base.rb
slack-ruby-bot-server-0.2.0 lib/slack-ruby-bot-server/ext/slack-ruby-bot/commands/base.rb