formatting

This commit is contained in:
William Kray
2025-09-09 21:21:51 -07:00
parent 5f42420619
commit a92759c100
14 changed files with 1380 additions and 967 deletions
+13 -13
View File
@@ -7,12 +7,12 @@ from mautrix.types import MessageType, MediaMessageEventContent
def flag_message(msg, censor_wordlist: list, censor_files: bool) -> bool:
"""Check if a message should be flagged for censorship.
Args:
msg: The message event to check
censor_wordlist: List of regex patterns to check against
censor_files: Whether to flag file messages
Returns:
bool: True if message should be flagged
"""
@@ -30,17 +30,17 @@ def flag_message(msg, censor_wordlist: list, censor_files: bool) -> bool:
except Exception:
# Skip invalid regex patterns
pass
return False
def flag_instaban(msg, instaban_wordlist: list) -> bool:
"""Check if a message should trigger an instant ban.
Args:
msg: The message event to check
instaban_wordlist: List of regex patterns that trigger instant ban
Returns:
bool: True if message should trigger instant ban
"""
@@ -51,17 +51,17 @@ def flag_instaban(msg, instaban_wordlist: list) -> bool:
except Exception:
# Skip invalid regex patterns
pass
return False
def censor_room(msg, censor_config) -> bool:
"""Check if a message should be censored based on room configuration.
Args:
msg: The message event to check
censor_config: Censor configuration (bool or list of room IDs)
Returns:
bool: True if message should be censored
"""
@@ -75,10 +75,10 @@ def censor_room(msg, censor_config) -> bool:
def sanitize_room_name(room_name: str) -> str:
"""Sanitize a room name for use in aliases.
Args:
room_name: The room name to sanitize
Returns:
str: Sanitized room name (alphanumeric only, lowercase)
"""
@@ -87,12 +87,12 @@ def sanitize_room_name(room_name: str) -> str:
def generate_community_slug(community_name: str) -> str:
"""Generate a community slug from the community name.
Args:
community_name: The full community name
Returns:
str: A slug made from the first letter of each word, lowercase
"""
words = community_name.strip().split()
return ''.join(word[0].lower() for word in words if word)
return "".join(word[0].lower() for word in words if word)