Last active
May 2, 2018 18:18
-
-
Save Akkiesoft/6c0e982821259a7d46d82a2e70ff029b to your computer and use it in GitHub Desktop.
https://gist.github.com/toshia/ee2c358b70ee7f690e82 のmikutter3.6以降向け
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plugin.create(:mikutter_profile_media) do | |
user_fragment :usermediatimeline, _("最近の画像つきツイート") do | |
set_icon File.join(File.dirname(__FILE__), "image.png") | |
uid = model.id | |
tw = Enumerator.new{|y| Plugin.filtering(:worlds, y)} | |
.select{|world| world.class.slug == :twitter }.first | |
i_timeline = timeline nil do | |
order do |message| | |
retweet = message.retweeted_statuses.find{ |r| uid == r.user.id } | |
(retweet || message)[:created].to_i end end | |
tw.search(q: "from:#{model[:idname]} filter:images", | |
count: [UserConfig[:profile_show_tweet_once], 200].min, | |
include_entities: true).next{ |tl| | |
tl.each do |message| | |
if message[:entities][:media] | |
i_timeline << message | |
end | |
end | |
}.terminate(_("@%{user} の最近のつぶやきが取得できませんでした。見るなってことですかね") % {user: model[:idname]}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment