clification
This commit is contained in:
parent
e7135a4689
commit
48100cd9d5
4 changed files with 39 additions and 20 deletions
9
lib/rocketchat/room.rb
Normal file
9
lib/rocketchat/room.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
require 'yaml'
|
||||||
|
|
||||||
|
module RocketChat
|
||||||
|
class Room
|
||||||
|
def show
|
||||||
|
data.to_yaml
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,6 +1,7 @@
|
||||||
$:.unshift File.dirname(__FILE__) unless $:.include? File.dirname(__FILE__)
|
require 'yaml'
|
||||||
|
|
||||||
require 'rocketchat'
|
require 'rocketchat'
|
||||||
require 'rocketchat/channel'
|
|
||||||
|
|
||||||
|
$:.unshift File.dirname(__FILE__) unless $:.include? File.dirname(__FILE__)
|
||||||
|
require 'rocketchat/room'
|
||||||
|
require 'rocketchat/messages/channel'
|
||||||
require 'rocketweekly/connect'
|
require 'rocketweekly/connect'
|
39
run.rb
39
run.rb
|
@ -1,21 +1,30 @@
|
||||||
require 'yaml'
|
|
||||||
require_relative './lib/rocketweekly'
|
require_relative './lib/rocketweekly'
|
||||||
|
|
||||||
|
case ARGV[0]
|
||||||
|
when 'list'
|
||||||
rocket = RocketWeekly::Connect.new
|
rocket = RocketWeekly::Connect.new
|
||||||
|
list = rocket.channels_list
|
||||||
output = {}
|
puts rocket.channels_list.map &:show
|
||||||
rocket.channels_list.each do |channel|
|
puts '---------------------'
|
||||||
output[channel.name] = {
|
puts "total: #{list.count} canaux"
|
||||||
'id' => channel.id,
|
when 'history'
|
||||||
'owner' => channel.owner ? channel.owner['username'] : '----'
|
rocket = RocketWeekly::Connect.new
|
||||||
}
|
week = ARGV[1]
|
||||||
puts '--------------'
|
channel = ARGV[2]
|
||||||
puts channel.name
|
puts channel
|
||||||
rocket.channel_history(channel.id).each do |m|
|
else
|
||||||
printf "%s %-20s\n", m['u']['username'], m['msg']
|
puts "Usage: #{ARGV[0]} <command> [<argument>]"
|
||||||
puts
|
puts
|
||||||
end
|
puts " possible commands:"
|
||||||
break
|
puts " list - list all channels information"
|
||||||
|
puts " history <week> <channel> - give messages for the given week"
|
||||||
end
|
end
|
||||||
|
|
||||||
puts '--------------'
|
# puts '--------------'
|
||||||
|
# puts channel.show
|
||||||
|
# # rocket.channel_history(channel.id).each do |m|
|
||||||
|
# # printf "%s %-20s\n", m['u']['username'], m['msg']
|
||||||
|
# # puts
|
||||||
|
# # end
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue