From e78738173aefd512bbce33c12b4ee3372bdc904b Mon Sep 17 00:00:00 2001
From: Mark Felder <feld@FreeBSD.org>
Date: Thu, 8 Oct 2020 12:41:01 -0500
Subject: [PATCH] Enforce that the followbot must be marked as a bot.

---
 lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex
index 52ac9aef7..d10b7b480 100644
--- a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex
+++ b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex
@@ -8,14 +8,15 @@ defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicy do
   @impl true
   def filter(message) do
     with follower_nickname <- Config.get([:mrf_follow_bot, :follower_nickname]),
-         %User{} = follower <- User.get_cached_by_nickname(follower_nickname),
+         %User{actor_type: "Service"} = follower <-
+           User.get_cached_by_nickname(follower_nickname),
          %{"type" => "Create", "object" => %{"type" => "Note"}} <- message do
       try_follow(follower, message)
     else
       nil ->
         Logger.warn(
-          "#{__MODULE__} skipped because of missing :mrf_follow_bot, :follower_nickname configuration or the account
-            does not exist."
+          "#{__MODULE__} skipped because of missing `:mrf_follow_bot, :follower_nickname` configuration, the :follower_nickname
+            account does not exist, or the account is not correctly configured as a bot."
         )
 
         {:ok, message}