Skip to content

Commit

Permalink
Update tos.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DoroWolf authored Jan 29, 2025
1 parent 64fb382 commit d8916b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/tos.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

from core.builtins import Bot
from core.config import Config
from core.constants.default import issue_url_default
Expand Down Expand Up @@ -69,8 +71,7 @@ async def warn_user(user: str, count: int = 1):
async def tos_report(sender: str, target: str, reason: str, banned: bool = False):
if report_targets:
warn_template = [f"[i18n:tos.message.report,sender={sender},target={target}]"]
if reason.startswith("{") and reason.endswith("}"):
reason = f"[i18n:{reason[1:-1]}]"
reason = re.sub(r"\{([^}]+)\}", lambda match: f"[i18n:{match.group(1)}]", reason)
warn_template.append("[i18n:tos.message.reason]" + reason)
if banned:
action = "[i18n:tos.message.action.blocked]"
Expand Down

0 comments on commit d8916b0

Please sign in to comment.