Sha256: 984a79c62b65b728737e3a0ceef52666db366d214baf0de8df34d7be5506e49a

Contents?: true

Size: 775 Bytes

Versions: 2

Compression:

Stored size: 775 Bytes

Contents

class SlackSmartBot
  # list of available emojis: https://www.webfx.com/tools/emoji-cheat-sheet/
  # react(:thumbsup)
  # ts: can be true, false or a specific ts
  def react(emoji, ts=false)
    if ts.is_a?(TrueClass) or ts.is_a?(FalseClass)
      parent = ts
      ts = nil
    else
      parent = false
    end
    if ts.nil?
      if parent or Thread.current[:ts].to_s == ''
        ts = Thread.current[:thread_ts]
      else
        ts = Thread.current[:ts]
      end
    end
    if ts.nil?
      @logger.warn 'react method no ts supplied'
    else
      begin
        client.web_client.reactions_add(channel: Thread.current[:dest], name: emoji, timestamp: ts) unless config.simulate
      rescue Exception => stack
        @logger.warn stack
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slack-smart-bot-1.9.2 lib/slack/smart-bot/comm/react.rb
slack-smart-bot-1.9.1 lib/slack/smart-bot/comm/react.rb