improve code style

master
Rachel Fae Fox (foxiepaws) 2019-07-31 15:25:10 -04:00
parent 86c45e7c08
commit 224851ad39
1 changed files with 8 additions and 4 deletions

View File

@ -5,11 +5,15 @@ defmodule Mix.Tasks.SystemBooster.Cron do
Application.ensure_all_started(:hackney)
app = Application.get_env(:systembooster, :app)
oauth = Application.get_env(:systembooster, :oauth)
realapp = %Hunter.Application{client_id: app[:client_id], client_secret: app[:client_secret], id: app[:app_id]}
conn = Hunter.new([base_url: app[:base_url], bearer_token: oauth[:token]])
list = Hunter.Api.HTTPClient.list_timeline(conn, Application.get_env(:systembooster, :list)[:list_id], [])
#Enum.map(Enum.reverse(Enum.sort_by(Enum.filter(list, fn (x) -> x.reblogged == false and (x.visibility == "public" or x.visibility == "unlisted") end),fn x -> x.id end)), fn x -> Hunter.reblog(conn, x.id) end)
Enum.map(Enum.reverse(Enum.filter(list, fn (x) -> x.reblogged == false and (x.visibility == "public" or x.visibility == "unlisted") end)), fn x -> Hunter.reblog(conn, x.id) end)
Hunter.Api.HTTPClient.list_timeline(conn, Application.get_env(:systembooster, :list)[:list_id], [])
|> Enum.filter(fn (x) -> x.reblogged == false and (x.visibility == "public" or x.visibility == "unlisted") end)
|> Enum.reverse
|> Enum.map(fn x -> Hunter.reblog(conn, x.id) end)
|> IO.inspect
end
end
# realapp = %Hunter.Application{client_id: app[:client_id], client_secret: app[:client_secret], id: app[:app_id]}
#Enum.map(Enum.reverse(Enum.sort_by(Enum.filter(list, fn (x) -> x.reblogged == false and (x.visibility == "public" or x.visibility == "unlisted") end),fn x -> x.id end)), fn x -> Hunter.reblog(conn, x.id) end)