INNER CODE UNIT · Python
add_user
TEAM-PYRO-BOTZ/PYRO-RENAME-BOT · helper/database.py:18
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)
async def total_users_count(self):
count = await self.col.count_documents({})
return count
async def get_all_users(self):
all_users = self.col.find({})
return all_users