diff --git a/classes/holo_user.py b/classes/holo_user.py index 4733798..20e472b 100644 --- a/classes/holo_user.py +++ b/classes/holo_user.py @@ -1,4 +1,5 @@ from datetime import datetime, timezone +import logging from random import randint from typing import Union, Any import discord @@ -11,6 +12,8 @@ try: except ImportError: from typing_extensions import Literal +logger = logging.getLogger(__name__) + class NotEnoughMoneyError(Exception): """User does not have enough money to do that""" @@ -182,7 +185,7 @@ class HoloUser: ) else: col_warnings.insert_one(document={"user": self.id, "warns": count}) - logWrite(f"User {self.id} was warned {count} times due to: {reason}") + logger.info(f"User {self.id} was warned {count} times due to: {reason}") # def cooldown_go(self, kind: Literal["work", "daily", "weekly", "monthly", "steal"]) -> None: # """Set cooldown start of kind now @@ -206,16 +209,16 @@ class HoloUser: col_users.update_one( filter={"_id": self.db_id}, update={"$set": {key: value}}, upsert=True ) - logWrite(f"Set attribute {key} of user {self.id} to {value}") + logger.info(f"Set attribute {key} of user {self.id} to {value}") - def purge(self) -> None: - """Completely remove data from database. Will not remove transactions logs and warnings.""" - col_users.delete_one(filter={"_id": self.db_id}) - self.unauthorize() + # def purge(self) -> None: + # """Completely remove data from database. Will not remove transactions logs and warnings.""" + # col_users.delete_one(filter={"_id": self.db_id}) + # self.unauthorize() - def unauthorize(self) -> None: - """Cancel Oauth2 authorization""" - col_authorized.find_one_and_delete({"user": self.id}) + # def unauthorize(self) -> None: + # """Cancel Oauth2 authorization""" + # col_authorized.find_one_and_delete({"user": self.id}) # def is_authorized(self) -> bool: # """Check if user provided Oauth2 authorization