diff options
author | href <href@random.sh> | 2020-04-17 15:53:14 +0200 |
---|---|---|
committer | href <href@random.sh> | 2020-04-17 15:53:14 +0200 |
commit | 919725a6941830ce82c835ed3288c1722ddd8c9f (patch) | |
tree | 49a95b0ce716a24c7e056036d3353ceca1debe4a /lib/lsg_irc/link_plugin | |
parent | welp (diff) |
bleh
Diffstat (limited to 'lib/lsg_irc/link_plugin')
-rw-r--r-- | lib/lsg_irc/link_plugin/imgur.ex | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/lsg_irc/link_plugin/imgur.ex b/lib/lsg_irc/link_plugin/imgur.ex index 9ce3cf3..1b8173f 100644 --- a/lib/lsg_irc/link_plugin/imgur.ex +++ b/lib/lsg_irc/link_plugin/imgur.ex @@ -43,10 +43,12 @@ defmodule LSG.IRC.LinkPlugin.Imgur do {:ok, %HTTPoison.Response{status_code: 200, body: body}} -> {:ok, json} = Jason.decode(body) data = json["data"] - IO.puts inspect(json) title = String.slice(data["title"] || data["description"], 0, 180) - nsfw = if data["nsfw"], do: "(NSFW) - ", else: "" - {:ok, "#{nsfw}#{title}"} + nsfw = if data["nsfw"], do: "(NSFW) - ", else: " " + height = Map.get(data, "height") + width = Map.get(data, "width") + size = Map.get(data, "size") + {:ok, "image, #{width}x#{height}, #{size} bytes #{nsfw}#{title}"} other -> :error end |