Sha256: da9feccba6cfe7f3509f715e5fcacda00e01da6fd953a39c9ffde1dedbb6b075

Contents?: true

Size: 1.44 KB

Versions: 18

Compression:

Stored size: 1.44 KB

Contents

class SlackSmartBot

  def see_shares()
    save_stats(__method__)
    typem = Thread.current[:typem]
    dest = Thread.current[:dest]
    if typem == :on_call
      channel = Thread.current[:dchannel]
    else
      channel = Thread.current[:dest]
    end

    general_message = "\nRelated commands `share messages /RegExp/ on #CHANNEL`, `share messages \"TEXT\" on #CHANNEL`, `delete share ID`"
    if File.exist?("#{config.path}/shares/#{@channels_name[channel]}.csv")
      t = CSV.table("#{config.path}/shares/#{@channels_name[channel]}.csv", headers: ['share_id', 'user_deleted', 'user_created', 'date', 'time', 'type', 'to_channel', 'condition'])
      message =[]
      t.each do |m|
        if m[:user_deleted] == ''
          if m[:type]=='text'
            emoji = ":abc:"
          elsif m[:type] == 'regexp'
            emoji = ":heavy_plus_sign:"
          else
            emoji = ':white_square:'
          end
          message << "\t#{m[:share_id]} #{emoji} *_#{m[:date]}_* #{m[:time]} *#{m[:user_created]}* <##{@channels_id[m[:to_channel]]}|#{m[:to_channel]}> : \t`#{m[:condition]}`"
        end
      end
      if message.size == 0
        message << "*There are no active shares right now.*"
      else
        message.unshift("*Shares from channel <##{channel}>*")
      end
      message << general_message
      respond message.join("\n"), dest
    else
      respond "*There are no active shares right now.*#{general_message}"
    end

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
slack-smart-bot-1.14.2 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.14.1 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.14.0 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.13.2 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.13.1 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.13.0 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.12.9 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.12.8 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.12.7 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.12.6 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.12.5 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.12.4 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.12.3 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.12.2 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.12.1 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.12.0 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.11.0 lib/slack/smart-bot/commands/general/see_shares.rb
slack-smart-bot-1.10.0 lib/slack/smart-bot/commands/general/see_shares.rb