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'
|
41
run.rb
41
run.rb
|
@ -1,21 +1,30 @@
|
||||||
require 'yaml'
|
|
||||||
require_relative './lib/rocketweekly'
|
require_relative './lib/rocketweekly'
|
||||||
|
|
||||||
rocket = RocketWeekly::Connect.new
|
case ARGV[0]
|
||||||
|
when 'list'
|
||||||
output = {}
|
rocket = RocketWeekly::Connect.new
|
||||||
rocket.channels_list.each do |channel|
|
list = rocket.channels_list
|
||||||
output[channel.name] = {
|
puts rocket.channels_list.map &:show
|
||||||
'id' => channel.id,
|
puts '---------------------'
|
||||||
'owner' => channel.owner ? channel.owner['username'] : '----'
|
puts "total: #{list.count} canaux"
|
||||||
}
|
when 'history'
|
||||||
puts '--------------'
|
rocket = RocketWeekly::Connect.new
|
||||||
puts channel.name
|
week = ARGV[1]
|
||||||
rocket.channel_history(channel.id).each do |m|
|
channel = ARGV[2]
|
||||||
printf "%s %-20s\n", m['u']['username'], m['msg']
|
puts channel
|
||||||
|
else
|
||||||
|
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