Change Relay from `status` to `{status, message}`
[akkoma] / lib / mix / tasks / relay_unfollow.ex
1 defmodule Mix.Tasks.RelayUnfollow do
2 use Mix.Task
3 require Logger
4 alias Pleroma.Web.ActivityPub.Relay
5
6 @moduledoc """
7 Unfollows a remote relay
8
9 Usage: ``mix relay_follow <relay_url>``
10
11 Example: ``mix relay_follow https://example.org/relay``
12 """
13 def run([target]) do
14 Mix.Task.run("app.start")
15
16 {status, message} = Relay.unfollow(target)
17
18 if :ok == status do
19 # put this task to sleep to allow the genserver to push out the messages
20 :timer.sleep(500)
21 else
22 Mix.puts("Error: #{inspect(message)}")
23 end
24 end
25 end