New generate config task from Pleroma upstream & move tasks namespace
Little fixes and tests Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
20
lib/mix/tasks/mobilizon/toot.ex
Normal file
20
lib/mix/tasks/mobilizon/toot.ex
Normal file
@@ -0,0 +1,20 @@
|
||||
defmodule Mix.Tasks.Mobilizon.Toot do
|
||||
@moduledoc """
|
||||
Creates a bot from a source
|
||||
"""
|
||||
|
||||
use Mix.Task
|
||||
require Logger
|
||||
|
||||
@shortdoc "Toot to an user"
|
||||
def run([from, content]) do
|
||||
Mix.Task.run("app.start")
|
||||
|
||||
with {:ok, _} <- MobilizonWeb.API.Comments.create_comment(from, content) do
|
||||
Mix.shell().info("Tooted")
|
||||
else
|
||||
{:local_actor, _} -> Mix.shell().error("Failed to toot.\nActor #{from} doesn't exist")
|
||||
_ -> Mix.shell().error("Failed to toot.")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user