Commit 057a5e2b authored by Wim Vanderbauwhede's avatar Wim Vanderbauwhede

Fixed warnings in bot framework

parent 10a747e4
Pipeline #3348 failed with stages
in 2 minutes and 7 seconds
......@@ -5,14 +5,17 @@ defmodule Pleroma.Bots.Common do
@has_bots length( @bots ) > 0
def feed_to_bot(params) do
if @has_bots do
{status,maybe_bot} = Activity.get_nickname(params)
if not status do
# try to get the bot nickname from the recipients
recipients = params["to"] ++ params["cc"]
{status,maybe_bot} = get_bot_nickname_from_recipients_list(recipients)
end
if status do
bot_lst = Enum.filter(@bots,fn( bot_name_atom ) -> maybe_bot== Atom.to_string(bot_name_atom) end)
{status_,maybe_bot_} = Activity.get_nickname(params)
{status,maybe_bot} = if not status_ do
# try to get the bot nickname from the recipients
recipients = params["to"] ++ params["cc"]
#{status,maybe_bot} =
get_bot_nickname_from_recipients_list(recipients)
else
{status_,maybe_bot_}
end
if status do
bot_lst = Enum.filter(@bots,fn( bot_name_atom ) -> maybe_bot== Atom.to_string(bot_name_atom) end)
is_bot = length( bot_lst )>0
if is_bot do
[ bot_name_atom ] = bot_lst
......@@ -66,11 +69,14 @@ defmodule Pleroma.Bots.Common do
# "cc" => []
def bot_post_status(orig_msg,status_details) do
{status,bot_name} = Activity.get_nickname(orig_msg)
if not status do
{status_,bot_name_} = Activity.get_nickname(orig_msg)
{status,bot_name} = if not status_ do
# try to get the bot nickname from the recipients
recipients = orig_msg["to"] ++ orig_msg["cc"]
{status,bot_name} = get_bot_nickname_from_recipients_list(recipients)
#{status,bot_name} =
get_bot_nickname_from_recipients_list(recipients)
else
{status_,bot_name_}
end
IO.inspect({status,bot_name})
if status do
......@@ -142,9 +148,11 @@ defmodule Pleroma.Bots.Common do
#"atomUri" => context_uri,#status_uri,
# not sure "tag" => [%{"href" => "https://pynq.limited.systems/users/pixelbot", "name" => "@pixelbot@pynq.limited.systems", "type" => "Mention"}],
# "url" => user_url<>"/"<>context_id,
# TODO
#{_,inReplyTo} = Activity.get_object_id(orig_msg)
#{_,conversation} = Activity.get_conversation(orig_msg)
{_,inReplyTo} = Activity.get_object_id(orig_msg)
{_,conversation} = Activity.get_conversation(orig_msg)
#object = if conversation != "" do
# Map.put(object,"conversation" ,conversation)
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment