summaryrefslogtreecommitdiff
path: root/lib/lsg_irc/link_plugin
diff options
context:
space:
mode:
authorhref <href@random.sh>2020-04-17 15:53:14 +0200
committerhref <href@random.sh>2020-04-17 15:53:14 +0200
commit919725a6941830ce82c835ed3288c1722ddd8c9f (patch)
tree49a95b0ce716a24c7e056036d3353ceca1debe4a /lib/lsg_irc/link_plugin
parentwelp (diff)
bleh
Diffstat (limited to 'lib/lsg_irc/link_plugin')
-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