Skip to content

Instantly share code, notes, and snippets.

@mpyw
Created March 20, 2017 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpyw/6021e70e60ec6677fff59fce9e0d722b to your computer and use it in GitHub Desktop.
Save mpyw/6021e70e60ec6677fff59fce9e0d722b to your computer and use it in GitHub Desktop.
Plugin.create(:inmuapi) do
[(1..4).to_a, "一二三四".chars].transpose.each do |num, knum|
command(:"inmuapi_#{num}", name: "真夏の夜の淫夢 #{knum}章", condition: -> _ { true }, visible: true, role: :postbox) do |opt|
res = Net::HTTP.get_response(URI.parse("http://api.yukkurisinai.net/inmu/story/#{num}"))
text = JSON.parse(res.body)["Plot"]
Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text = text
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment