Improved bans
This commit is contained in:
parent
bf8ec39584
commit
e235fe0ed2
@ -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
29
validation/bans.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user