akn-dev / akn /manage /payment_bots.py
randydev's picture
fix revert back and update
21bc372
from pyrogram import *
from pyrogram.types import *
from pyrogram import Client as ren
from datetime import datetime as dt, timedelta
from akn.utils.database import db as db_client
@ren.on_callback_query(filters.regex("^premium_upgrades$"))
async def premium_upgrade_okx(_, callback: CallbackQuery):
await callback.message.edit_text(
"πŸ’Ž Premium Subscription\n\n"
"Benefits:\n"
"- Deploy second bot\n"
"- Priority support\n"
"- Advanced features\n\n"
"Price: $5/month\n\n"
"Payment options:",
reply_markup=InlineKeyboardMarkup([
[InlineKeyboardButton("πŸ’³ Credit Card", callback_data="payx_cc")],
[InlineKeyboardButton("🌎 Crypto", callback_data="payx_crypto")],
[InlineKeyboardButton("πŸ“± Mobile Payment", callback_data="payx_mobile")],
[InlineKeyboardButton("Β« Back", callback_data="back")]
])
)
await callback.answer()
@ren.on_callback_query(filters.regex("^payx_"))
async def handle_payment(client, callback: CallbackQuery):
payment_method = callback.data.replace("payx_", "")
user_id = callback.from_user.id
return await callback.answer("Soon we will add this feature", show_alert=True)
expiry_date = dt.now() + timedelta(days=30)
await db_client.gemini_bot.update_one(
{"user_id": user_id},
{"$set": {
"has_premium": True,
"premium_expiry": expiry_date,
"payment_method": payment_method
}}
)
await callback.message.edit_text(
"πŸŽ‰ Payment Successful!\n\n"
"You now have premium access for 30 days!\n\n"
"You can now deploy your second bot with /deploy",
reply_markup=None
)
await client.send_message(
user_id,
f"πŸ“ Receipt\n\n"
f"Premium Subscription\n"
f"Amount: $5.00\n"
f"Method: {payment_method}\n"
f"Expires: {expiry_date.strftime('%Y-%m-%d')}"
)