Merge Beta with Stable releases #1
@ -2,7 +2,8 @@ from os import path, sep
|
|||||||
from app import app, isAnAdmin
|
from app import app, isAnAdmin
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.enums.chat_members_filter import ChatMembersFilter
|
from pyrogram.enums.chat_members_filter import ChatMembersFilter
|
||||||
from modules.utils import configGet, jsonLoad, locale, should_quote
|
from modules.utils import configGet, locale, should_quote
|
||||||
|
from modules.database import col_warnings
|
||||||
|
|
||||||
# Warnings command =============================================================================================================
|
# Warnings command =============================================================================================================
|
||||||
@app.on_message(~ filters.scheduled & filters.command(["warnings"], prefixes=["/"]))
|
@app.on_message(~ filters.scheduled & filters.command(["warnings"], prefixes=["/"]))
|
||||||
@ -10,8 +11,6 @@ async def cmd_warnings(app, msg):
|
|||||||
|
|
||||||
if msg.chat.id == configGet("admin_group") or await isAnAdmin(msg.from_user.id):
|
if msg.chat.id == configGet("admin_group") or await isAnAdmin(msg.from_user.id):
|
||||||
|
|
||||||
warnings = jsonLoad(f"{configGet('data', 'locations')}{sep}warnings.json")
|
|
||||||
|
|
||||||
if len(msg.command) <= 1:
|
if len(msg.command) <= 1:
|
||||||
await msg.reply_text(locale("syntax_warnings", "message"), quote=should_quote(msg))
|
await msg.reply_text(locale("syntax_warnings", "message"), quote=should_quote(msg))
|
||||||
|
|
||||||
@ -31,11 +30,13 @@ async def cmd_warnings(app, msg):
|
|||||||
await msg.reply_text(locale("no_user_warnings", "message").format(msg.command[1]))
|
await msg.reply_text(locale("no_user_warnings", "message").format(msg.command[1]))
|
||||||
return
|
return
|
||||||
|
|
||||||
if target_id not in warnings:
|
warns = len(list(col_warnings.find({"user": target_id})))
|
||||||
|
|
||||||
|
if warns == 0:
|
||||||
await msg.reply_text(locale("no_warnings", "message").format(target_name, target_id), quote=should_quote(msg))
|
await msg.reply_text(locale("no_warnings", "message").format(target_name, target_id), quote=should_quote(msg))
|
||||||
else:
|
else:
|
||||||
if warnings[target_id] <= 5:
|
if warns <= 5:
|
||||||
await msg.reply_text(locale("warnings_1", "message").format(target_name, target_id, warnings[target_id]), quote=should_quote(msg))
|
await msg.reply_text(locale("warnings_1", "message").format(target_name, target_id, warns), quote=should_quote(msg))
|
||||||
else:
|
else:
|
||||||
await msg.reply_text(locale("warnings_2", "message").format(target_name, target_id, warnings[target_id]), quote=should_quote(msg))
|
await msg.reply_text(locale("warnings_2", "message").format(target_name, target_id, warns), quote=should_quote(msg))
|
||||||
# ==============================================================================================================================
|
# ==============================================================================================================================
|
Reference in New Issue
Block a user