Fix unban user cmd

This commit is contained in:
Yasir Aris M 2024-08-27 13:24:29 +07:00 committed by GitHub
parent 0ba4e87593
commit 47ce746635
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -51,7 +51,7 @@ class UsersData:
async def get_ban_status(self, id): async def get_ban_status(self, id):
user = await self.col.find_one({"_id": int(id)}) user = await self.col.find_one({"_id": int(id)})
return (True, user) if user else (False, None) return user if user else False
async def get_all_users(self): async def get_all_users(self):
return self.col.find({}) return self.col.find({})

View file

@ -121,7 +121,7 @@ async def unban_a_user(bot, message):
return await message.reply(f"Error - {e}") return await message.reply(f"Error - {e}")
else: else:
jar = await db.get_ban_status(k.id) jar = await db.get_ban_status(k.id)
if not jar["is_banned"]: if not jar:
return await message.reply(f"{k.mention} is not yet banned.") return await message.reply(f"{k.mention} is not yet banned.")
await db.remove_ban(k.id) await db.remove_ban(k.id)
await message.reply(f"Successfully unbanned user {k.mention}!!!") await message.reply(f"Successfully unbanned user {k.mention}!!!")