38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
|
from datetime import datetime
|
||
|
from app import app
|
||
|
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
||
|
from pyrogram import filters
|
||
|
from classes.holo_user import HoloUser
|
||
|
from modules.utils import configGet, locale, logWrite
|
||
|
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):
|
||
|
|
||
|
fullclb = clb.data.split("_")
|
||
|
holo_user = HoloUser(int(fullclb[2]))
|
||
|
|
||
|
logWrite(f"User {holo_user.id} applied for sponsorship")
|
||
|
|
||
|
col_tmp.insert_one(
|
||
|
{
|
||
|
"user": holo_user.id,
|
||
|
"type": "sponsorship",
|
||
|
"complete": False,
|
||
|
"sent": False,
|
||
|
"state": "fill",
|
||
|
"stage": 1,
|
||
|
"sponsorship": {
|
||
|
"streamer": None,
|
||
|
"expires": datetime.fromtimestamp(0),
|
||
|
"proof": None,
|
||
|
"label": ""
|
||
|
}
|
||
|
}
|
||
|
)
|
||
|
|
||
|
edited_markup = [[InlineKeyboardButton(text=str(locale("sponsor_started", "button")), callback_data="nothing")]]
|
||
|
|
||
|
await clb.message.edit(text=locale("sponsorship_apply", "message"), reply_markup=InlineKeyboardMarkup(edited_markup))
|
||
|
await clb.answer(text=locale("sponsor_started", "callback").format(holo_user.id), show_alert=False)
|