Sha256: 0a9ada0da90e3798bd54ea183d50b36587eae17d3b961142933d144350fcc8c6

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

class SlackSmartBot

  #to send messages without listening for a response to users
  def send_msg_user(id_user, msg)
    unless msg == ""
      if id_user[0] == "D"
        if config[:simulate]
          open("#{config.path}/buffer_complete.log", "a") { |f|
            f.puts "|#{id_user}|#{config[:nick_id]}|#{msg}~~~"
          }
        else  
          client.message(channel: id_user, as_user: true, text: msg)
        end
        if config[:testing] and config.on_master_bot
          open("#{config.path}/buffer.log", "a") { |f|
            f.puts "|#{id_user}|#{config[:nick_id]}|#{msg}"
          }
        end
      else
        im = client.web_client.im_open(user: id_user)
        if config[:simulate]
          open("#{config.path}/buffer_complete.log", "a") { |f|
            f.puts "|#{im["channel"]["id"]}|#{config[:nick_id]}|#{msg}~~~"
          }
        else  
          client.message(channel: im["channel"]["id"], as_user: true, text: msg)
        end
        if config[:testing] and config.on_master_bot
          open("#{config.path}/buffer.log", "a") { |f|
            f.puts "|#{im["channel"]["id"]}|#{config[:nick_id]}|#{msg}"
          }
        end
      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
slack-smart-bot-1.4.3 lib/slack/smart-bot/comm/send_msg_user.rb
slack-smart-bot-1.4.2 lib/slack/smart-bot/comm/send_msg_user.rb
slack-smart-bot-1.4.1 lib/slack/smart-bot/comm/send_msg_user.rb
slack-smart-bot-1.4.0 lib/slack/smart-bot/comm/send_msg_user.rb