Merge Beta with Stable releases #1
@ -10,8 +10,8 @@ async def cmd_warn(app, msg):
|
||||
|
||||
if msg.chat.id == configGet("destination_group"):
|
||||
if msg.reply_to_message_id != None:
|
||||
if isAnAdmin(msg.from_user.id):
|
||||
message = " ".join(msg.command[2:]) if len(msg.command) > 1 else ""
|
||||
if await isAnAdmin(msg.from_user.id):
|
||||
message = " ".join(msg.command[1:]) if len(msg.command) > 1 else ""
|
||||
col_warnings.insert_one({"user": msg.reply_to_message.from_user.id, "admin": msg.from_user.id, "date": datetime.now(), "reason": message})
|
||||
if message == "":
|
||||
await msg.reply_text(locale("warned", "message").format(msg.reply_to_message.from_user.first_name, msg.reply_to_message.from_user.id))
|
||||
|
@ -1,23 +1,23 @@
|
||||
from os import path, sep
|
||||
from app import app, isAnAdmin
|
||||
from pyrogram import filters
|
||||
from pyrogram.enums.chat_members_filter import ChatMembersFilter
|
||||
from modules.utils import configGet, locale, should_quote
|
||||
from modules.database import col_warnings
|
||||
from modules.database import col_users, col_warnings
|
||||
|
||||
# Warnings command =============================================================================================================
|
||||
@app.on_message(~ filters.scheduled & filters.command(["warnings"], prefixes=["/"]))
|
||||
async def cmd_warnings(app, msg):
|
||||
|
||||
if msg.chat.id == configGet("admin_group") or await isAnAdmin(msg.from_user.id):
|
||||
if await isAnAdmin(msg.from_user.id):
|
||||
|
||||
if len(msg.command) <= 1:
|
||||
await msg.reply_text(locale("syntax_warnings", "message"), quote=should_quote(msg))
|
||||
|
||||
if path.exists(f"{configGet('data', 'locations')}{sep}users{sep}{msg.command[1]}.json"):
|
||||
target_id = str(int(msg.command[1]))
|
||||
target_name = "N/A"
|
||||
else:
|
||||
try:
|
||||
user_db = col_users.find_one({"user": int(msg.command[1])})
|
||||
target_id = user_db["user"]
|
||||
target_name = user_db["tg_name"]
|
||||
except:
|
||||
list_of_users = []
|
||||
async for m in app.get_chat_members(configGet("destination_group"), filter=ChatMembersFilter.SEARCH, query=msg.command[1]):
|
||||
list_of_users.append(m)
|
||||
|
Reference in New Issue
Block a user