mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-03 11:04:51 +00:00
Tes add ban user to db
Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
parent
147a10d80b
commit
4d43e984a8
1 changed files with 6 additions and 5 deletions
|
|
@ -44,15 +44,16 @@ class UsersData:
|
||||||
return await self.col.count_documents({})
|
return await self.col.count_documents({})
|
||||||
|
|
||||||
async def remove_ban(self, id):
|
async def remove_ban(self, id):
|
||||||
await self.col.delete_one({"id": id})
|
await self.col.delete_one({"_id": id})
|
||||||
|
|
||||||
async def ban_user(self, user_id, ban_reason="No Reason"):
|
async def ban_user(self, user_id, ban_reason="No Reason"):
|
||||||
await self.col.insert_one({"id": user_id, "reason": ban_reason})
|
await self.col.insert_one({"_id": user_id, "reason": ban_reason})
|
||||||
|
|
||||||
async def get_ban_status(self, id):
|
async def get_ban_status(self, id):
|
||||||
default = dict(is_banned=False, ban_reason="")
|
user = await self.col.find_one({"_id": int(id)})
|
||||||
user = await self.col.find_one({"id": int(id)})
|
if user:
|
||||||
return user.get("ban_status", default) if user else default
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
async def get_all_users(self):
|
async def get_all_users(self):
|
||||||
return self.col.find({})
|
return self.col.find({})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue