Sha256: 73eec8e557a946e14b17a2be04da6c97ba5049d571382ee331c9fff124fc46a2
Contents?: true
Size: 944 Bytes
Versions: 4
Compression:
Stored size: 944 Bytes
Contents
class SlackSmartBot # to: (String) Channel name or id # msg: (String) message to send def send_msg_channel(to, msg) unless msg == "" get_channels_name_and_id() unless @channels_name.key?(to) or @channels_id.key?(to) if @channels_name.key?(to) #it is an id channel_id = to elsif @channels_id.key?(to) #it is a channel name channel_id = @channels_id[to] else @logger.fatal "Channel: #{to} not found. Message: #{msg}" end if config[:simulate] open("#{config.path}/buffer_complete.log", "a") { |f| f.puts "|#{channel_id}|#{config[:nick_id]}|#{msg}~~~" } else client.message(channel: channel_id, text: msg, as_user: true) end if config[:testing] and config.on_master_bot open("#{config.path}/buffer.log", "a") { |f| f.puts "|#{channel_id}|#{config[:nick_id]}|#{msg}" } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems