INNER CODE UNIT · Python
__init__
TEAM-PYRO-BOTZ/PYRO-RENAME-BOT · helper/database.py:6
def __init__(self, uri, database_name):
self._client = AsyncIOMotorClient(uri)
self.db = self._client[database_name]
self.col = self.db.user
def new_user(self, id):
return dict(
_id=int(id),
file_id=None,
caption=None
)
async def add_user(self, b, m):
u = m.from_user
if not await self.is_user_exist(u.id):
user = self.new_user(u.id)
await self.col.insert_one(user)
await send_log(b, u)