Application and sponsorship crosscheck
This commit is contained in:
@@ -3,7 +3,7 @@ from app import app
|
||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, ReplyKeyboardRemove
|
||||
from pyrogram import filters
|
||||
from classes.holo_user import HoloUser
|
||||
from modules.utils import configGet, locale, logWrite
|
||||
from modules.utils import configGet, locale, logWrite, should_quote
|
||||
from modules.handlers.confirmation import confirm_yes
|
||||
from modules.handlers.welcome import welcome_pass
|
||||
from modules.database import col_tmp, col_applications
|
||||
@@ -76,6 +76,11 @@ async def callback_query_reapply_reject(app, clb):
|
||||
@app.on_callback_query(filters.regex("reapply_old_[\s\S]*"))
|
||||
async def callback_query_reapply_old(app, clb):
|
||||
fullclb = clb.data.split("_")
|
||||
|
||||
if HoloUser(clb.from_user).sponsorship_state()[0] == "fill":
|
||||
await clb.message.reply_text(locale("finish_sponsorship", "message"), quote=False))
|
||||
return
|
||||
|
||||
message = await app.get_messages(clb.from_user.id, int(fullclb[2]))
|
||||
await confirm_yes(app, message, kind="application")
|
||||
await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button", locale=clb.from_user), "nothing")]]))
|
||||
@@ -86,6 +91,10 @@ async def callback_query_reapply_new(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
|
||||
if HoloUser(clb.from_user).sponsorship_state()[0] == "fill":
|
||||
await clb.message.reply_text(locale("finish_sponsorship", "message"), quote=False))
|
||||
return
|
||||
|
||||
await clb.answer(locale("reapply_stopped", "callback", locale=clb.from_user))
|
||||
message = await app.get_messages(clb.from_user.id, int(fullclb[2]))
|
||||
col_tmp.update_one({"user": clb.from_user.id}, {"$set": {"state": "fill", "completed": False, "stage": 1}})
|
||||
|
@@ -1,18 +1,23 @@
|
||||
from datetime import datetime
|
||||
from app import app
|
||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, ForceReply
|
||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, ForceReply, CallbackQuery
|
||||
from pyrogram.client import Client
|
||||
from pyrogram import filters
|
||||
from classes.holo_user import HoloUser
|
||||
from modules.utils import configGet, locale, logWrite
|
||||
from modules.utils import configGet, locale, logWrite, should_quote
|
||||
from modules.database import col_tmp, col_sponsorships
|
||||
|
||||
# Callbacks sponsorship ========================================================================================================
|
||||
@app.on_callback_query(filters.regex("sponsor_apply_[\s\S]*"))
|
||||
async def callback_query_sponsor_apply(app, clb):
|
||||
async def callback_query_sponsor_apply(app: Client, clb: CallbackQuery):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
holo_user = HoloUser(int(fullclb[2]))
|
||||
|
||||
if holo_user.application_state()[0] == "fill":
|
||||
await clb.message.reply_text(locale("finish_application", "message"), quote=should_quote(clb.message))
|
||||
return
|
||||
|
||||
logWrite(f"User {holo_user.id} applied for sponsorship")
|
||||
|
||||
holo_user.sponsorship_restart()
|
||||
|
Reference in New Issue
Block a user