aboutsummaryrefslogtreecommitdiffstats
path: root/core/plugin/core/core.rb
diff options
context:
space:
mode:
Diffstat (limited to 'core/plugin/core/core.rb')
-rw-r--r--core/plugin/core/core.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/plugin/core/core.rb b/core/plugin/core/core.rb
index c3fd7a8f..0d669554 100644
--- a/core/plugin/core/core.rb
+++ b/core/plugin/core/core.rb
@@ -75,7 +75,11 @@ Module.new do
@twitter_configuration = JSON.parse(file_get_contents(File.join(__dir__, 'configuration.json'.freeze)), symbolize_names: true)
onappear do |messages|
- retweets = messages.select(&:retweet?).map{|m|m.retweet_ancestors.to_a[-2]}
+ retweets = messages.select(&:retweet?).map do |message|
+ result = message.retweet_ancestors.to_a[-2]
+ fail "invalid retweet #{message.inspect}. ancestors: #{message.retweet_ancestors.to_a.inspect}" unless result.is_a?(Message)
+ result
+ end
if not(retweets.empty?)
Plugin.call(:retweet, retweets) end end