aboutsummaryrefslogtreecommitdiffstats
path: root/core/plugin/command/conditions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'core/plugin/command/conditions.rb')
-rw-r--r--core/plugin/command/conditions.rb24
1 files changed, 13 insertions, 11 deletions
diff --git a/core/plugin/command/conditions.rb b/core/plugin/command/conditions.rb
index 305ae086..7c09da57 100644
--- a/core/plugin/command/conditions.rb
+++ b/core/plugin/command/conditions.rb
@@ -47,7 +47,9 @@ module ::Plugin::Command
# 選択されているツイートのうち、一つでも現在のアカウントでリツイートできるものがあれば真を返す
CanReTweetAny = Condition.new { |opt|
current_world, = Plugin.filtering(:world_current, nil)
- opt.messages.lazy.map(&current_world.method(:|)).any?{|c| c.retweetable? && !c.retweeted? }
+ opt.messages.lazy.any?{|m|
+ Plugin[:command].retweet?(current_world, m) && !Plugin[:command].retweeted?(current_world, m)
+ }
}
# 選択されているツイートが全て、現在のアカウントでリツイート可能な時、真を返す。
@@ -55,8 +57,8 @@ module ::Plugin::Command
# ツイートが選択されていなければ偽
CanReTweetAll = Condition.new{ |opt|
current_world, = Plugin.filtering(:world_current, nil)
- not opt.messages.empty? and opt.messages.lazy.map(&current_world.method(:|)).all?{ |c|
- c.retweetable? and !c.retweeted_by_me?
+ !opt.messages.empty? && opt.messages.lazy.all?{|m|
+ Plugin[:command].retweet?(current_world, m) && !Plugin[:command].retweeted?(current_world, m)
}
}
@@ -64,16 +66,16 @@ module ::Plugin::Command
# ツイートが選択されていなければ偽
IsReTweetedAll = Condition.new{ |opt|
current_world, = Plugin.filtering(:world_current, nil)
- not opt.messages.empty? and opt.messages.lazy.map(&current_world.method(:|)).all?{ |c|
- c.retweetable? and c.retweeted_by_me?
+ !opt.messages.empty? && opt.messages.lazy.all?{|m|
+ Plugin[:command].destroy_retweet?(current_world, m)
}
}
# 選択されているツイートのうち、一つでも現在のアカウントでふぁぼれるものがあれば真を返す
CanFavoriteAny = Condition.new { |opt|
current_world, = Plugin.filtering(:world_current, nil)
- opt.messages.lazy.map(&current_world.method(:|)).any?{ |c|
- c.favoritable? and !c.favorited_by_me?
+ opt.messages.any?{|m|
+ Plugin[:command].favorite?(current_world, m) && !Plugin[:command].favorited?(current_world, m)
}
}
@@ -82,8 +84,8 @@ module ::Plugin::Command
# ツイートが選択されていなければ偽
CanFavoriteAll = Condition.new{ |opt|
current_world, = Plugin.filtering(:world_current, nil)
- not opt.messages.empty? and opt.messages.lazy.map(&current_world.method(:|)).all? { |c|
- c.favoritable? and !c.favorited_by_me?
+ !opt.messages.empty? and opt.messages.all?{|m|
+ Plugin[:command].favorite?(current_world, m)
}
}
@@ -91,8 +93,8 @@ module ::Plugin::Command
# ツイートが選択されていなければ偽
IsFavoritedAll = Condition.new{ |opt|
current_world, = Plugin.filtering(:world_current, nil)
- not opt.messages.empty? and opt.messages.lazy.map(&current_world.method(:|)).all? { |c|
- c.favoritable? and c.favorited_by_me?
+ !opt.messages.empty? and opt.messages.all?{|m|
+ Plugin[:command].unfavorite?(current_world, m)
}
}