INNER CODE UNIT · Python

Database

TEAM-PYRO-BOTZ/PYRO-RENAME-BOT · helper/database.py:5

class Database:
    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)            

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…