25 lines
1.7 KiB
Python
25 lines
1.7 KiB
Python
from datetime import datetime
|
|
from app import app, isAnAdmin
|
|
from pyrogram import filters
|
|
from modules.utils import should_quote
|
|
from modules.database import col_applications
|
|
|
|
# Sponsorship command ==========================================================================================================
|
|
@app.on_message(~ filters.scheduled & filters.command(["sponsorship"], prefixes=["/"]))
|
|
async def cmd_sponsorship(app, msg):
|
|
if (await isAnAdmin(msg) is True) or (col_applications.find_one({"user": msg.from_user.id}) is not None):
|
|
await msg.reply_text("Yes, I exist.", quote=should_quote(msg))
|
|
# if not path.exists(f"{configGet('data', 'locations')}{sep}sponsors{sep}{msg.from_user.id}.json"):
|
|
# jsonSave(jsonLoad(f"{configGet('data', 'locations')}{sep}sponsor_default.json"), f"{configGet('data', 'locations')}{sep}sponsors{sep}{msg.from_user.id}.json")
|
|
# sponsor = jsonLoad(f"{configGet('data', 'locations')}{sep}sponsors{sep}{msg.from_user.id}.json")
|
|
# if sponsor["approved"]:
|
|
# if sponsor["expires"] is not None:
|
|
# if datetime.strptime(sponsor["expires"], "%d.%m.%Y") > datetime.now():
|
|
# await msg.reply_text(f"You have an active sub til **{sponsor['expires']}**.")
|
|
# else:
|
|
# await msg.reply_text(f"Your sub expired {int((datetime.now()-datetime.strptime(sponsor['expires'], '%d.%m.%Y')).days)} days ago.")
|
|
# elif sponsor["approved"]:
|
|
# await msg.reply_text(f"Your sub expiration date is not valid.")
|
|
# else:
|
|
# await msg.reply_text(f"You have no active subscription.")
|
|
# ============================================================================================================================== |