Improved bans

This commit is contained in:
Profitroll 2023-04-02 18:42:11 +02:00
parent bf8ec39584
commit e235fe0ed2
2 changed files with 33 additions and 1 deletions

View File

@ -1,3 +1,4 @@
from datetime import datetime
from app import app, isAnAdmin from app import app, isAnAdmin
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
from pyrogram import filters from pyrogram import filters
@ -12,7 +13,9 @@ async def callback_query_reject(app: Client, clb: CallbackQuery):
fullclb = clb.data.split("_") fullclb = clb.data.split("_")
if not await isAnAdmin(int(fullclb[1])): if not await isAnAdmin(int(fullclb[1])):
col_bans.insert_one({"user": int(fullclb[1])}) col_bans.insert_one(
{"user": int(fullclb[1]), "admin": clb.from_user.id, "date": datetime.now()}
)
edited_markup = [ edited_markup = [
[ [

29
validation/bans.json Normal file
View File

@ -0,0 +1,29 @@
{
"$jsonSchema": {
"required": [
"user",
"admin",
"date"
],
"properties": {
"user": {
"bsonType": [
"int",
"long"
],
"description": "Telegram ID of user"
},
"admin": {
"bsonType": [
"int",
"long"
],
"description": "Telegram ID of admin"
},
"date": {
"bsonType": "date",
"description": "Date and time of getting"
}
}
}
}