Class: Slack::CLI::App

Inherits:
Base
  • Object
show all
Defined in:
lib/slack/cli/app.rb

Instance Method Summary collapse

Instance Method Details

#export(channel_id) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/slack/cli/app.rb', line 31

def export(channel_id)
  args = options.merge(channel: channel_id)

  if args.key?(:oldest)
    parse_slack_timestamp(args[:oldest])
  end

  if args.key?(:latest)
    args[:latest] = parse_slack_timestamp(args[:latest])
  end

  case channel_id
  when /^C/
    puts client.channels.history(args)
  when /^D/
    puts client.im.history(args)
  else
    fail ArgumentError, "Unknown channel format (got `#{channel_id}')"
  end
end