Merge Beta with Stable releases #1

Merged
profitroll merged 52 commits from dev into master 2022-12-16 16:14:41 +02:00
Showing only changes of commit d7a087bcfb - Show all commits

View File

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