18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/twitter2mastodon.rb', line 18
def
message_count = 0
return unless options[:configfile]
configuration = Twitter2Mastodon::Configuration.new(options[:configfile])
puts configuration.inspect if options[:ultraverbose]
= configuration.
mastodon = configuration.mastodon_client
@store = Twitter2Mastodon::Store.new
users = if options[:user]
[options[:user]]
else
configuration.users
end
users.each do |user|
last_twitt = .user_timeline(user).reject(&:retweet?).reject(&:user_mentions?).first
last_twitt = @store.add_to_store(Twitter2Mastodon::Status.new(last_twitt))
if last_twitt
mastodon.create_status(last_twitt.status)
message_count += 1
puts "Succefully published #{last_twitt.message}" if options[:ultraverbose]
else
puts "No new status has been published" if options[:ultraverbose]
end
end
puts @store.store if options[:ultraverbose]
return unless options[:verbose]
if message_count
puts "Succefully published #{message_count} status"
else
puts "No status published as expected"
end
end
|