Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
Yasir Aris M 2023-10-21 23:06:45 +07:00
parent be002580b5
commit 2782df412a
2 changed files with 5 additions and 5 deletions

View file

@ -44,10 +44,10 @@ 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}) return 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}) return 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):
user = await self.col.find_one({"_id": int(id)}) user = await self.col.find_one({"_id": int(id)})

View file

@ -12,10 +12,10 @@ from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO, SUPPORT_CHAT
async def ban_reply(_, ctx: Message): async def ban_reply(_, ctx: Message):
if not ctx.from_user: if not ctx.from_user:
return return
userban = await db.get_ban_status(ctx.from_user.id) isban, alesan = await db.get_ban_status(ctx.from_user.id)
if userban: if isban:
await ctx.reply_msg( await ctx.reply_msg(
f'I am sorry, You are banned to use Me. \nBan Reason: {ban["ban_reason"]}' f'I am sorry, You are banned to use Me. \nBan Reason: {alesan["reason"]}'
) )
await ctx.stop_propagation() await ctx.stop_propagation()