summaryrefslogtreecommitdiff
path: root/lib/lsg_irc/link_plugin/imgur.ex
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/lsg_irc/link_plugin/imgur.ex8
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