lib/ayadn/action.rb in ayadn-1.7.6 vs lib/ayadn/action.rb in ayadn-1.7.7
- old
+ new
@@ -581,10 +581,11 @@
if options[:poster]
settings = options.dup
options = NowWatching.new.get_poster(settings[:poster], settings)
end
resp = writer.reply({options: options, text: text, id: post_id, reply_to: replied_to})
+ FileOps.save_post(resp) if Settings.options[:backup][:auto_save_sent_posts]
# ----
options = options.dup
unless resp['data']['reply_to'].nil?
options[:reply_to] = resp['data']['reply_to'].to_i
end
@@ -593,21 +594,28 @@
rescue => e
Errors.global_error({error: e, caller: caller, data: [post_id, options]})
end
end
- def send_to_channel(channel_id)
+ def send_to_channel(channel_id, options = {})
begin
channel_id = @workers.get_channel_id_from_alias(channel_id)
writer = Post.new
puts Status.writing
- puts Status.post
+ puts Status.message
lines_array = writer.compose
writer.check_message_length(lines_array)
@view.clear_screen
puts Status.posting
- resp = writer.message({id: channel_id, text: lines_array.join("\n")})
- save_and_view(resp)
+ if options[:poster]
+ settings = options.dup
+ options = NowWatching.new.get_poster(settings[:poster], settings)
+ end
+ resp = writer.message({options: options, id: channel_id, text: lines_array.join("\n")})
+ FileOps.save_message(resp) if Settings.options[:backup][:auto_save_sent_messages]
+ @view.clear_screen
+ puts Status.yourpost
+ @view.show_posted(resp)
rescue => e
Errors.global_error({error: e, caller: caller, data: [channel_id]})
end
end