Data export, warnings' improvements, bug fixes #35
@ -1,9 +1,10 @@
|
|||||||
|
from os import path
|
||||||
from app import app
|
from app import app
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.types import Message
|
from pyrogram.types import Message
|
||||||
from pyrogram.client import Client
|
from pyrogram.client import Client
|
||||||
from pyrogram.enums.chat_members_filter import ChatMembersFilter
|
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.database import col_users, col_warnings
|
||||||
from modules import custom_filters
|
from modules import custom_filters
|
||||||
|
|
||||||
@ -18,7 +19,12 @@ async def cmd_warnings(app: Client, msg: Message):
|
|||||||
if len(msg.command) == 1:
|
if len(msg.command) == 1:
|
||||||
warnings = {}
|
warnings = {}
|
||||||
warnings_output = []
|
warnings_output = []
|
||||||
|
group_members = jsonLoad(
|
||||||
|
path.join(configGet("cache", "locations"), "group_members")
|
||||||
|
)
|
||||||
for warning in col_warnings.find({"active": True}):
|
for warning in col_warnings.find({"active": True}):
|
||||||
|
if warning["user"] not in group_members:
|
||||||
|
continue
|
||||||
if str(warning["user"]) not in warnings:
|
if str(warning["user"]) not in warnings:
|
||||||
warnings[str(warning["user"])] = {
|
warnings[str(warning["user"])] = {
|
||||||
"name": (col_users.find_one({"user": warning["user"]}))["tg_name"],
|
"name": (col_users.find_one({"user": warning["user"]}))["tg_name"],
|
||||||
|
Reference in New Issue
Block a user