/warnings now also considers user membership
This commit is contained in:
parent
1f45398de5
commit
a3f75bec7c
@ -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"],
|
||||
|
Reference in New Issue
Block a user