Sha256: 7052ca4996a7f0aa4fbca940124d549ba5d65fd23bb8ff17517cdbbd93b8a103

Contents?: true

Size: 718 Bytes

Versions: 3

Compression:

Stored size: 718 Bytes

Contents

class SlackSmartBot
    def answer_delete(user = Thread.current[:user], dest = Thread.current[:dest])
        if user.is_a?(String)
            if user.match?(/^[A-Z0-9]{7,11}_/)
                from = user
            else
                from = "#{config.team_id}_#{user}"
            end
        else
            from = "#{user.team_id}_#{user.name}"
        end
        if @answer.key?(from)
            if Thread.current[:on_thread]
                dest = Thread.current[:thread_ts]
            end
            if @answer[from].key?(dest)
                @answer[from].delete(dest)
            end
            @questions.delete(from) # to be backwards compatible #todo: remove when 2.0
        end
    end

  end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-smart-bot-1.15.25 lib/slack/smart-bot/utils/answer_delete.rb
slack-smart-bot-1.15.1 lib/slack/smart-bot/utils/answer_delete.rb
slack-smart-bot-1.15.0 lib/slack/smart-bot/utils/answer_delete.rb