Merge pull request #3 from kr0sh512/copilot/update-vpn-plans-with-multiplier
Generate `/start` plan pricing dynamically with per-user multiplier and real VPN username
This commit is contained in:
@@ -305,16 +305,21 @@ class VpnBot:
|
||||
)
|
||||
|
||||
async def cmd_start(self, message: Message) -> None:
|
||||
username = f"tg{message.from_user.id}"
|
||||
current = await self.marzban.get_user(username)
|
||||
multiplier = self._extract_price_multiplier((current or {}).get("note"))
|
||||
kb = InlineKeyboardBuilder()
|
||||
for months, stars in PLANS.items():
|
||||
kb.button(text=f"{months} month — ⭐️{stars}", callback_data=f"buy:{months}")
|
||||
plan_lines: list[str] = []
|
||||
for months, base_stars in PLANS.items():
|
||||
month_label = "month" if months == 1 else "months"
|
||||
stars = self._stars_with_multiplier(base_stars, multiplier)
|
||||
kb.button(text=f"{months} {month_label} — ⭐️{stars}", callback_data=f"buy:{months}")
|
||||
plan_lines.append(f"• {months} {month_label} — {stars} stars")
|
||||
kb.adjust(1)
|
||||
await message.answer(
|
||||
"VPN subscription plans:\n"
|
||||
"• 1 month — 100 stars\n"
|
||||
"• 3 months — 270 stars\n"
|
||||
"• 6 months — 500 stars\n\n"
|
||||
"Username in VPN panel: <code>tg{your_telegram_id}</code>",
|
||||
+ "\n".join(plan_lines)
|
||||
+ f"\n\nUsername in VPN panel: <code>{username}</code>",
|
||||
reply_markup=kb.as_markup(),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user