feat: add ban reason in /user
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
5d4ff660c3
commit
56f1026341
1 changed files with 14 additions and 1 deletions
15
commands.py
15
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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue