This repository has been archived on 2024-10-15. You can view files and clone it, but cannot push or open issues or pull requests.
PyrogramBotBase/classes/pyrouser.py

24 lines
517 B
Python
Raw Normal View History

2023-08-03 22:29:47 +03:00
from typing import Union
from attrs import define
from bson import ObjectId
from modules.database import col_users
@define
class PyroUser:
"""Dataclass of DB entry of a user"""
_id: ObjectId
id: int
locale: Union[str, None]
async def update_locale(self, locale: str) -> None:
"""Change user's locale stored in the database
### Args:
* locale (`str`): New locale to be set
"""
col_users.update_one({"_id": self._id}, {"$set": {"locale": locale}})