From 820cb0c1e838faefd898bd10f5dc767a86ec84f7 Mon Sep 17 00:00:00 2001 From: sco1 Date: Tue, 18 Dec 2018 16:55:53 -0500 Subject: Make reason a required input to bb watch Resolves #218 --- bot/cogs/bigbrother.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bot/cogs/bigbrother.py b/bot/cogs/bigbrother.py index 7964c81a8..0f2cc7ac8 100644 --- a/bot/cogs/bigbrother.py +++ b/bot/cogs/bigbrother.py @@ -220,9 +220,14 @@ class BigBrother: """ Relay messages sent by the given `user` to the `#big-brother-logs` channel - If a `reason` is specified, a note is added for `user` + A `reason` for watching is required, which is added for the user to be watched as a + note (aka: shadow warning) """ + if not reason: + await ctx.send(":x: A reason for watching this user is required") + return + channel_id = Channels.big_brother_logs post_data = { @@ -251,10 +256,9 @@ class BigBrother: reason = data.get('error_message', "no message provided") await ctx.send(f":x: the API returned an error: {reason}") - # Add a note (shadow warning) if a reason is specified - if reason: - reason = "bb watch: " + reason # Prepend for situational awareness - await post_infraction(ctx, user, type="warning", reason=reason, hidden=True) + # Add a note (shadow warning) with the reason for watching + reason = "bb watch: " + reason # Prepend for situational awareness + await post_infraction(ctx, user, type="warning", reason=reason, hidden=True) @bigbrother_group.command(name='unwatch', aliases=('uw',)) @with_role(Roles.owner, Roles.admin, Roles.moderator) -- cgit v1.2.3 From 4716565247ea749193f19f0e95e05eeaf4d70288 Mon Sep 17 00:00:00 2001 From: sco1 Date: Mon, 24 Dec 2018 16:39:40 -0500 Subject: Remove reason check --- bot/cogs/bigbrother.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bot/cogs/bigbrother.py b/bot/cogs/bigbrother.py index 0f2cc7ac8..31dbf8b5e 100644 --- a/bot/cogs/bigbrother.py +++ b/bot/cogs/bigbrother.py @@ -216,18 +216,13 @@ class BigBrother: @bigbrother_group.command(name='watch', aliases=('w',)) @with_role(Roles.owner, Roles.admin, Roles.moderator) - async def watch_command(self, ctx: Context, user: User, *, reason: str = None): + async def watch_command(self, ctx: Context, user: User, *, reason: str): """ Relay messages sent by the given `user` to the `#big-brother-logs` channel A `reason` for watching is required, which is added for the user to be watched as a note (aka: shadow warning) """ - - if not reason: - await ctx.send(":x: A reason for watching this user is required") - return - channel_id = Channels.big_brother_logs post_data = { -- cgit v1.2.3 From 6b49afeb6afe6ecdbc5325723c3106588b85c62b Mon Sep 17 00:00:00 2001 From: sco1 Date: Mon, 24 Dec 2018 16:40:24 -0500 Subject: Add linebreak --- bot/cogs/bigbrother.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bot/cogs/bigbrother.py b/bot/cogs/bigbrother.py index 31dbf8b5e..29b13f038 100644 --- a/bot/cogs/bigbrother.py +++ b/bot/cogs/bigbrother.py @@ -223,6 +223,7 @@ class BigBrother: A `reason` for watching is required, which is added for the user to be watched as a note (aka: shadow warning) """ + channel_id = Channels.big_brother_logs post_data = { -- cgit v1.2.3