This repository has been archived on 2024-08-21. You can view files and clone it, but cannot push or open issues or pull requests.
TelegramPoster/classes/user.py
2023-02-17 21:54:52 +01:00

17 lines
521 B
Python

from datetime import datetime
from modules.database import col_banned
class PosterUser():
def __init__(self, id: int):
self.id = id
def is_blocked(self) -> bool:
return False if col_banned.find_one({"user": self.id}) is None else True
def block(self) -> None:
if col_banned.find_one({"user": self.id}) is None:
col_banned.insert_one({"user": self.id, "date": datetime.now()})
def unblock(self) -> None:
col_banned.find_one_and_delete({"user": self.id})