From 765961e784ca5c1d949bd4b02251d3d3132760a8 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sat, 31 Oct 2020 16:06:42 +0000 Subject: Add new activity block constant --- bot/constants.py | 1 + config-default.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/bot/constants.py b/bot/constants.py index 23d5b4304..4d41f4eb2 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -600,6 +600,7 @@ class VoiceGate(metaclass=YAMLGetter): minimum_days_verified: int minimum_messages: int bot_message_delete_delay: int + minimum_activity_blocks: int class Event(Enum): diff --git a/config-default.yml b/config-default.yml index 071f6e1ec..a2cabf5fc 100644 --- a/config-default.yml +++ b/config-default.yml @@ -521,6 +521,7 @@ voice_gate: minimum_days_verified: 3 # How many days the user must have been verified for minimum_messages: 50 # How many messages a user must have to be eligible for voice bot_message_delete_delay: 10 # Seconds before deleting bot's response in Voice Gate + minimum_activity_blocks: 3 # Number of 10 minute blocks during which a user must have been active config: -- cgit v1.2.3 From 732d526807021f0e273840d31b4dff39eb8fe0bb Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sat, 31 Oct 2020 16:12:44 +0000 Subject: Add activity blocks threshold to voice gate --- bot/exts/moderation/voice_gate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py index c2743e136..b9ddc1093 100644 --- a/bot/exts/moderation/voice_gate.py +++ b/bot/exts/moderation/voice_gate.py @@ -25,6 +25,7 @@ MESSAGE_FIELD_MAP = { "verified_at": f"have been verified for less than {GateConf.minimum_days_verified} days", "voice_banned": "have an active voice ban infraction", "total_messages": f"have sent less than {GateConf.minimum_messages} messages", + "activity_blocks": f"have been active for less than {GateConf.minimum_activity_blocks} ten-minute blocks" } @@ -50,6 +51,7 @@ class VoiceGate(Cog): - You must have over a certain number of messages within the Discord server - You must have accepted our rules over a certain number of days ago - You must not be actively banned from using our voice channels + - You must have been active for over a certain number of 10-minute blocks. """ try: data = await self.bot.api_client.get(f"bot/users/{ctx.author.id}/metricity_data") @@ -88,7 +90,8 @@ class VoiceGate(Cog): checks = { "verified_at": data["verified_at"] > datetime.utcnow() - timedelta(days=GateConf.minimum_days_verified), "total_messages": data["total_messages"] < GateConf.minimum_messages, - "voice_banned": data["voice_banned"] + "voice_banned": data["voice_banned"], + "activity_blocks": data["activity_blocks"] < GateConf.activity_blocks } failed = any(checks.values()) failed_reasons = [MESSAGE_FIELD_MAP[key] for key, value in checks.items() if value is True] -- cgit v1.2.3 From 54fd8c03aaf2cf7509867a223c5b54366bd8f1e0 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sun, 1 Nov 2020 02:27:07 +0000 Subject: Remove full stop --- bot/exts/moderation/voice_gate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py index b9ddc1093..cf64c4e52 100644 --- a/bot/exts/moderation/voice_gate.py +++ b/bot/exts/moderation/voice_gate.py @@ -51,7 +51,7 @@ class VoiceGate(Cog): - You must have over a certain number of messages within the Discord server - You must have accepted our rules over a certain number of days ago - You must not be actively banned from using our voice channels - - You must have been active for over a certain number of 10-minute blocks. + - You must have been active for over a certain number of 10-minute blocks """ try: data = await self.bot.api_client.get(f"bot/users/{ctx.author.id}/metricity_data") -- cgit v1.2.3 From e0fba54b56d9fc7a7acfc7d7651f9b34b9e0712f Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sun, 1 Nov 2020 02:28:17 +0000 Subject: Change wording of failure message and re-add trailing comma --- bot/exts/moderation/voice_gate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py index cf64c4e52..78fc1e619 100644 --- a/bot/exts/moderation/voice_gate.py +++ b/bot/exts/moderation/voice_gate.py @@ -25,7 +25,7 @@ MESSAGE_FIELD_MAP = { "verified_at": f"have been verified for less than {GateConf.minimum_days_verified} days", "voice_banned": "have an active voice ban infraction", "total_messages": f"have sent less than {GateConf.minimum_messages} messages", - "activity_blocks": f"have been active for less than {GateConf.minimum_activity_blocks} ten-minute blocks" + "activity_blocks": f"have been active for fewer than {GateConf.minimum_activity_blocks} ten-minute blocks", } -- cgit v1.2.3 From f076231f9919c1f9320c48e5e4af7a1ad2a0401f Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sun, 1 Nov 2020 02:28:43 +0000 Subject: Indent inline comment by two spaces in config-default.yml --- config-default.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config-default.yml b/config-default.yml index a2cabf5fc..2afdcd594 100644 --- a/config-default.yml +++ b/config-default.yml @@ -521,7 +521,7 @@ voice_gate: minimum_days_verified: 3 # How many days the user must have been verified for minimum_messages: 50 # How many messages a user must have to be eligible for voice bot_message_delete_delay: 10 # Seconds before deleting bot's response in Voice Gate - minimum_activity_blocks: 3 # Number of 10 minute blocks during which a user must have been active + minimum_activity_blocks: 3 # Number of 10 minute blocks during which a user must have been active config: -- cgit v1.2.3 From 52c9d0706da2ab8253894679df1b113f1e4c51ae Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sun, 1 Nov 2020 02:29:30 +0000 Subject: Correct activity block config name in voice gate extension --- bot/exts/moderation/voice_gate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py index 78fc1e619..529dca53d 100644 --- a/bot/exts/moderation/voice_gate.py +++ b/bot/exts/moderation/voice_gate.py @@ -91,7 +91,7 @@ class VoiceGate(Cog): "verified_at": data["verified_at"] > datetime.utcnow() - timedelta(days=GateConf.minimum_days_verified), "total_messages": data["total_messages"] < GateConf.minimum_messages, "voice_banned": data["voice_banned"], - "activity_blocks": data["activity_blocks"] < GateConf.activity_blocks + "activity_blocks": data["activity_blocks"] < GateConf.minimum_activity_blocks } failed = any(checks.values()) failed_reasons = [MESSAGE_FIELD_MAP[key] for key, value in checks.items() if value is True] -- cgit v1.2.3 From 399f286a157b21e860f606b4f4fed11bb29490f2 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sun, 1 Nov 2020 13:53:07 +0000 Subject: Correct 404 error message in voice gate command --- bot/exts/moderation/voice_gate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py index 529dca53d..9fd553441 100644 --- a/bot/exts/moderation/voice_gate.py +++ b/bot/exts/moderation/voice_gate.py @@ -60,8 +60,8 @@ class VoiceGate(Cog): embed = discord.Embed( title="Not found", description=( - "We were unable to find user data for you. " - "Please try again shortly, " + "We were unable to find user data for you. ", + "Please try again shortly, ", "if this problem persists please contact the server staff through Modmail.", ), color=Colour.red() -- cgit v1.2.3 From 176d22c8b3cd9fe226778327f9eb9ff080101a04 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sun, 1 Nov 2020 15:36:16 +0000 Subject: Actually fix the issue @kwzrd pointed out --- bot/exts/moderation/voice_gate.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py index 9fd553441..93d96693c 100644 --- a/bot/exts/moderation/voice_gate.py +++ b/bot/exts/moderation/voice_gate.py @@ -60,9 +60,9 @@ class VoiceGate(Cog): embed = discord.Embed( title="Not found", description=( - "We were unable to find user data for you. ", - "Please try again shortly, ", - "if this problem persists please contact the server staff through Modmail.", + "We were unable to find user data for you. " + "Please try again shortly, " + "if this problem persists please contact the server staff through Modmail." ), color=Colour.red() ) -- cgit v1.2.3