Repository: python-discord/bot

Issue:
Using BB watch should show info about any previous unwatch reason.
We provide a reason when unwatching someone, which should be info that is displayed in case someone goes to watch them again. This could be particularly helpful for nominations also.


Discussion:
Would like to work on this. Can you clarify where the info should be displayed? I was thinking right after the command is invoked e.g. "This user has previously been watched for the following reason:". It could display the most recent reason or perhaps display them all.
The most recent watch & a count of total watches is probably an ok start.
That is good to know. Do you agree with my proposal to display it after the command is invoked then?
Yes, that seems reasonable

Resolving patch:
diff --git a/bot/cogs/watchchannels/bigbrother.py b/bot/cogs/watchchannels/bigbrother.py
--- a/bot/cogs/watchchannels/bigbrother.py
+++ b/bot/cogs/watchchannels/bigbrother.py
@@ -70,7 +70,27 @@ async def watch_command(self, ctx: Context, user: Union[User, proxy_user], *, re
 
         if response is not None:
             self.watched_users[user.id] = response
-            await ctx.send(f":white_check_mark: Messages sent by {user} will now be relayed to Big Brother.")
+            msg = f":white_check_mark: Messages sent by {user} will now be relayed to Big Brother."
+
+            history = await self.bot.api_client.get(
+                self.api_endpoint,
+                params={
+                    "user__id": str(user.id),
+                    "active": "false",
+                    'type': 'watch',
+                    'ordering': '-inserted_at'
+                }
+            )
+
+            if len(history) > 1:
+                total = f"({len(history) // 2} previous infractions in total)"
+                end_reason = history[0]["reason"]
+                start_reason = f"Watched: {history[1]['reason']}"
+                msg += f"\n\nUser's previous watch reasons {total}:```{start_reason}\n\n{end_reason}```"
+        else:
+            msg = ":x: Failed to post the infraction: response was empty."
+
+        await ctx.send(msg)
 
     @bigbrother_group.command(name='unwatch', aliases=('uw',))
     @with_role(Roles.owner, Roles.admin, Roles.moderator)
diff --git a/bot/cogs/watchchannels/talentpool.py b/bot/cogs/watchchannels/talentpool.py
--- a/bot/cogs/watchchannels/talentpool.py
+++ b/bot/cogs/watchchannels/talentpool.py
@@ -93,7 +93,24 @@ async def watch_command(self, ctx: Context, user: Union[Member, User, proxy_user
                 resp.raise_for_status()
 
         self.watched_users[user.id] = response_data
-        await ctx.send(f":white_check_mark: Messages sent by {user} will now be relayed to the talent pool channel")
+        msg = f":white_check_mark: Messages sent by {user} will now be relayed to the talent pool channel"
+
+        history = await self.bot.api_client.get(
+            self.api_endpoint,
+            params={
+                "user__id": str(user.id),
+                "active": "false",
+                "ordering": "-inserted_at"
+            }
+        )
+
+        if history:
+            total = f"({len(history)} previous nominations in total)"
+            start_reason = f"Watched: {history[0]['reason']}"
+            end_reason = f"Unwatched: {history[0]['end_reason']}"
+            msg += f"\n\nUser's previous watch reasons {total}:```{start_reason}\n\n{end_reason}```"
+
+        await ctx.send(msg)
 
     @nomination_group.command(name='history', aliases=('info', 'search'))
     @with_role(Roles.owner, Roles.admin, Roles.moderator)


Test patch: