aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/constants.py2
-rw-r--r--bot/exts/info/information.py19
-rw-r--r--bot/exts/moderation/voice_gate.py10
-rw-r--r--config-default.yml2
4 files changed, 9 insertions, 24 deletions
diff --git a/bot/constants.py b/bot/constants.py
index 08ae0d52f..c4bb6b2d6 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -606,7 +606,7 @@ class Verification(metaclass=YAMLGetter):
class VoiceGate(metaclass=YAMLGetter):
section = "voice_gate"
- minimum_days_verified: int
+ minimum_days_member: int
minimum_messages: int
bot_message_delete_delay: int
minimum_activity_blocks: int
diff --git a/bot/exts/info/information.py b/bot/exts/info/information.py
index 187950689..5450ff377 100644
--- a/bot/exts/info/information.py
+++ b/bot/exts/info/information.py
@@ -225,12 +225,12 @@ class Information(Cog):
if is_set and (emoji := getattr(constants.Emojis, f"badge_{badge}", None)):
badges.append(emoji)
- verified_at, activity = await self.user_verification_and_messages(user)
+ activity = await self.user_messages(user)
if on_server:
joined = time_since(user.joined_at, max_units=3)
roles = ", ".join(role.mention for role in user.roles[1:])
- membership = {"Joined": joined, "Verified": verified_at or "False", "Roles": roles or None}
+ membership = {"Joined": joined, "Verified": user.pending, "Roles": roles or None}
if not is_mod_channel(ctx.channel):
membership.pop("Verified")
@@ -360,30 +360,21 @@ class Information(Cog):
return "Nominations", "\n".join(output)
- async def user_verification_and_messages(self, user: FetchedMember) -> Tuple[Union[bool, str], Tuple[str, str]]:
+ async def user_messages(self, user: FetchedMember) -> Tuple[Union[bool, str], Tuple[str, str]]:
"""
- Gets the time of verification and amount of messages for `member`.
+ Gets the amount of messages for `member`.
Fetches information from the metricity database that's hosted by the site.
If the database returns a code besides a 404, then many parts of the bot are broken including this one.
"""
activity_output = []
- verified_at = False
try:
user_activity = await self.bot.api_client.get(f"bot/users/{user.id}/metricity_data")
except ResponseCodeError as e:
if e.status == 404:
activity_output = "No activity"
-
else:
- try:
- if (verified_at := user_activity["verified_at"]) is not None:
- verified_at = time_since(parser.isoparse(verified_at), max_units=3)
- except ValueError:
- log.warning(f"Could not parse ISO string correctly for user {user.id} verification date.")
- verified_at = None
-
activity_output.append(user_activity["total_messages"] or "No messages")
activity_output.append(user_activity["activity_blocks"] or "No activity")
@@ -391,7 +382,7 @@ class Information(Cog):
f"{name}: {metric}" for name, metric in zip(["Messages", "Activity blocks"], activity_output)
)
- return verified_at, ("Activity", activity_output)
+ return ("Activity", activity_output)
def format_fields(self, mapping: Mapping[str, Any], field_width: Optional[int] = None) -> str:
"""Format a mapping to be readable to a human."""
diff --git a/bot/exts/moderation/voice_gate.py b/bot/exts/moderation/voice_gate.py
index 4d48d2c1b..b8f37adf2 100644
--- a/bot/exts/moderation/voice_gate.py
+++ b/bot/exts/moderation/voice_gate.py
@@ -29,7 +29,7 @@ FAILED_MESSAGE = (
)
MESSAGE_FIELD_MAP = {
- "verified_at": f"have been verified for less than {GateConf.minimum_days_verified} days",
+ "joined_at": f"have been on the server for less than {GateConf.minimum_days_member} 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",
@@ -149,14 +149,8 @@ class VoiceGate(Cog):
await ctx.author.send(embed=embed)
return
- # Pre-parse this for better code style
- if data["verified_at"] is not None:
- data["verified_at"] = parser.isoparse(data["verified_at"])
- else:
- data["verified_at"] = datetime.utcnow() - timedelta(days=3)
-
checks = {
- "verified_at": data["verified_at"] > datetime.utcnow() - timedelta(days=GateConf.minimum_days_verified),
+ "joined_at": ctx.author.joined_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.minimum_activity_blocks
diff --git a/config-default.yml b/config-default.yml
index 006743342..3f3f66962 100644
--- a/config-default.yml
+++ b/config-default.yml
@@ -526,7 +526,7 @@ verification:
voice_gate:
- minimum_days_verified: 3 # How many days the user must have been verified for
+ minimum_days_member: 3 # How many days the user must have been a member 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