INNER CODE UNIT · Python

new_user

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

    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)

    async def is_user_exist(self, id):
        user = await self.col.find_one({'_id': int(id)})
        return bool(user)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…