Karan Adhikari commited on
Update subscription.py
Browse files
Backend/pyrofork/plugins/subscription.py
CHANGED
|
@@ -45,14 +45,24 @@ async def plan_selection(client: Client, callback_query: CallbackQuery):
|
|
| 45 |
|
| 46 |
expiry_str = new_expiry.strftime("%Y-%m-%d %H:%M UTC")
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
text = (
|
| 49 |
f"<b>β
Plan Selected: {plan['days']} Days</b>\n\n"
|
| 50 |
f"<b>π° Price:</b> βΉ{plan['price']}\n"
|
| 51 |
f"<b>π
Expiry (if approved now):</b> {expiry_str}\n\n"
|
| 52 |
-
f"<b>π
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
)
|
| 57 |
|
| 58 |
# Set pending payment state (price stored for admin display)
|
|
@@ -62,9 +72,18 @@ async def plan_selection(client: Client, callback_query: CallbackQuery):
|
|
| 62 |
dm_sent = False
|
| 63 |
from pyrogram.types import ForceReply
|
| 64 |
|
| 65 |
-
# Always try to DM the user directly so the screenshot handler (filters.private) picks it up
|
| 66 |
-
dm_sent = False
|
| 67 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
await client.send_message(
|
| 69 |
chat_id=user_id,
|
| 70 |
text=text,
|
|
|
|
| 45 |
|
| 46 |
expiry_str = new_expiry.strftime("%Y-%m-%d %H:%M UTC")
|
| 47 |
|
| 48 |
+
settings = SettingsManager.current()
|
| 49 |
+
payment_instructions = settings.payment_instructions
|
| 50 |
+
payment_qr_url = settings.payment_qr_url
|
| 51 |
+
|
| 52 |
text = (
|
| 53 |
f"<b>β
Plan Selected: {plan['days']} Days</b>\n\n"
|
| 54 |
f"<b>π° Price:</b> βΉ{plan['price']}\n"
|
| 55 |
f"<b>π
Expiry (if approved now):</b> {expiry_str}\n\n"
|
| 56 |
+
f"<b>π How to Pay:</b>\n"
|
| 57 |
+
)
|
| 58 |
+
if payment_instructions:
|
| 59 |
+
text += f"{payment_instructions}\n\n"
|
| 60 |
+
else:
|
| 61 |
+
# No payment method configured by the admin β show a safe fallback.
|
| 62 |
+
text += f"Pay βΉ{plan['price']} to the admin.\n\n"
|
| 63 |
+
text += (
|
| 64 |
+
f"<b>After paying:</b> send your payment screenshot directly here "
|
| 65 |
+
f"(in this chat). The admin will review and activate your subscription."
|
| 66 |
)
|
| 67 |
|
| 68 |
# Set pending payment state (price stored for admin display)
|
|
|
|
| 72 |
dm_sent = False
|
| 73 |
from pyrogram.types import ForceReply
|
| 74 |
|
|
|
|
|
|
|
| 75 |
try:
|
| 76 |
+
# Send the QR image first (if the admin configured one) so it appears
|
| 77 |
+
# above the instructions.
|
| 78 |
+
if payment_qr_url:
|
| 79 |
+
try:
|
| 80 |
+
await client.send_photo(
|
| 81 |
+
chat_id=user_id,
|
| 82 |
+
photo=payment_qr_url,
|
| 83 |
+
caption=f"π· Scan to pay βΉ{plan['price']}",
|
| 84 |
+
)
|
| 85 |
+
except Exception as qe:
|
| 86 |
+
print(f"Could not send payment QR to {user_id}: {qe}")
|
| 87 |
await client.send_message(
|
| 88 |
chat_id=user_id,
|
| 89 |
text=text,
|