From 56f1026341aff9d535bf6c1185647850ecc55b9d Mon Sep 17 00:00:00 2001 From: mctaylors Date: Sun, 8 Jun 2025 10:03:40 +0300 Subject: [PATCH] feat: add ban reason in /user Signed-off-by: mctaylors --- commands.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/commands.py b/commands.py index ed6f98a..d9b01a6 100644 --- a/commands.py +++ b/commands.py @@ -8,7 +8,7 @@ from telegram.constants import ParseMode from telegram.ext import ContextTypes import html_parser -from datetime import datetime +from datetime import datetime, timedelta from config import * from extensions import get_json, format_rating, format_status, humanize_filesize @@ -250,6 +250,19 @@ async def user_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No ] ) ) + if user_data["is_banned"]: + ban_data = get_json( + f"bans", [f"search[user_id]={user_data['id']}"] + )[0] + m.append( + " ".join( + [ + "Ban reason:", + ban_data["reason"], + f"(banned for {timedelta(seconds=ban_data['duration'])})" + ] + ) + ) fav_post_count = get_json(f"counts/posts", [f"tags=fav:{user_data['name']}"])[ "counts" ]["posts"]