lib/ayadn/scroll.rb in ayadn-1.7.7 vs lib/ayadn/scroll.rb in ayadn-1.8.0
- old
+ new
@@ -91,9 +91,18 @@
loop do
begin
stream = @api.get_messages(channel_id, options)
Debug.stream stream, options, channel_id
show_if_new(stream, options, "channel:#{channel_id}")
+ if Settings.options[:marker][:update_messages] == true
+ unless resp['meta']['max_id'].nil?
+ marked = @api.update_marker("channel:#{channel_id}", stream['meta']['max_id'])
+ updated = JSON.parse(marked)
+ if updated['meta']['code'] != 200
+ Errors.warn "couldn't update channel #{channel_id} as read"
+ end
+ end
+ end
options = save_then_return(stream, options, "channel:#{channel_id}")
countdown
rescue Interrupt
canceled
end