Started working on sponsorships

This commit is contained in:
2022-12-21 12:25:47 +01:00
parent b345a5d776
commit d3945eea0c
4 changed files with 64 additions and 6 deletions

View File

@@ -1,14 +1,17 @@
from datetime import datetime
from app import app, isAnAdmin
from pyrogram import filters
from modules.utils import should_quote
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from modules.utils import locale, 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))
await msg.reply_text(locale("sponsorship_apply", "message"), reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text=str(locale("sponsor_apply", "button")), callback_data=f"sponsor_apply_{msg.from_user.id}")]]), quote=should_quote(msg))
else:
await msg.reply_text(locale("sponsorship_application_empty", "message"))
# 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")