From a3f75bec7c6b02a3b18a08131d31649f48669816 Mon Sep 17 00:00:00 2001 From: profitroll Date: Sun, 2 Apr 2023 21:38:23 +0200 Subject: [PATCH] /warnings now also considers user membership --- modules/commands/warnings.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/commands/warnings.py b/modules/commands/warnings.py index f712ca6..b65cc4e 100644 --- a/modules/commands/warnings.py +++ b/modules/commands/warnings.py @@ -1,9 +1,10 @@ +from os import path from app import app from pyrogram import filters from pyrogram.types import Message from pyrogram.client import Client from pyrogram.enums.chat_members_filter import ChatMembersFilter -from modules.utils import configGet, locale, should_quote +from modules.utils import configGet, jsonLoad, locale, should_quote from modules.database import col_users, col_warnings from modules import custom_filters @@ -18,7 +19,12 @@ async def cmd_warnings(app: Client, msg: Message): if len(msg.command) == 1: warnings = {} warnings_output = [] + group_members = jsonLoad( + path.join(configGet("cache", "locations"), "group_members") + ) for warning in col_warnings.find({"active": True}): + if warning["user"] not in group_members: + continue if str(warning["user"]) not in warnings: warnings[str(warning["user"])] = { "name": (col_users.find_one({"user": warning["user"]}))["tg_name"],