Does some tasks from #34

This commit is contained in:
2023-04-02 16:44:46 +02:00
parent 43e71c95c4
commit 972827d6c2
5 changed files with 75 additions and 6 deletions

View File

@@ -24,6 +24,8 @@ async def cmd_warn(app: Client, msg: Message):
"admin": msg.from_user.id,
"date": datetime.now(),
"reason": message,
"active": True,
"revoke_date": None,
}
)
if message == "":

View File

@@ -23,7 +23,7 @@ async def cmd_warnings(app: Client, msg: Message):
return
try:
user_db = col_users.find_one({"user": int(msg.command[1])})
user_db = col_users.find_one({"user": int(msg.command[1]), "active": True})
target_id = user_db["user"]
target_name = user_db["tg_name"]
except:
@@ -47,7 +47,7 @@ async def cmd_warnings(app: Client, msg: Message):
)
return
warns = col_warnings.count_documents({"user": target_id})
warns = col_warnings.count_documents({"user": target_id, "active": True})
if warns == 0:
await msg.reply_text(