diff options
| author | 2020-11-01 14:22:30 -0500 | |
|---|---|---|
| committer | 2020-11-01 14:22:30 -0500 | |
| commit | 0b7a1be1dd57a464fc79fcb235b79d75bec43f99 (patch) | |
| tree | d4cafd89b4025d0b57779b24e1be778d8c4f4d05 | |
| parent | Fix incorrect argument for _send_log when filtering evals (diff) | |
| parent | Actually fix the issue @kwzrd pointed out (diff) | |
Merge pull request #1265 from python-discord/voicegate/activity-blocks
Voice Gate: User activity blocks
| -rw-r--r-- | bot/constants.py | 1 | ||||
| -rw-r--r-- | bot/exts/moderation/voice_gate.py | 7 | ||||
| -rw-r--r-- | config-default.yml | 1 |
3 files changed, 7 insertions, 2 deletions
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/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py index c2743e136..93d96693c 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 fewer 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") @@ -60,7 +62,7 @@ class VoiceGate(Cog): 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.", + "if this problem persists please contact the server staff through Modmail." ), color=Colour.red() ) @@ -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.minimum_activity_blocks } failed = any(checks.values()) failed_reasons = [MESSAGE_FIELD_MAP[key] for key, value in checks.items() if value is True] diff --git a/config-default.yml b/config-default.yml index 071f6e1ec..2afdcd594 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: |