17 lines
521 B
Python
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})
|