feat: add user-facing Telegram bot with trial, payments and referrals#2016
Open
muitiiifruckt wants to merge 1 commit intoGozargah:masterfrom
Open
feat: add user-facing Telegram bot with trial, payments and referrals#2016muitiiifruckt wants to merge 1 commit intoGozargah:masterfrom
muitiiifruckt wants to merge 1 commit intoGozargah:masterfrom
Conversation
New separate TeleBot instance (TELEGRAM_USER_BOT_TOKEN) running in its own daemon thread alongside the existing admin bot without touching it. Features: - /start: auto-creates trial account (configurable days/GB), supports referral deeplinks (ref_CODE) - Personal cabinet: live status, traffic used/remaining, expiry date - Config section: subscription URL + QR code generation in-memory - Telegram Stars payments (1/3/6 months) with invoice flow and automatic Xray sync on successful payment - Referral system: configurable bonus days, hard cap on total bonus, optional require-payment mode to prevent farming DB changes: - Alembic migration a1b2c3d4e5f6 adds telegram_id, referral_code, referred_by_id columns to the users table - New CRUD helpers: get_user_by_telegram_id, get_user_by_referral_code, link_user_telegram_id, set_user_referral_code, record_referral, extend_user_expire, count_user_referrals Bug fixes in bot code: - DetachedInstanceError: _account_text() now called inside session - IntegrityError on race condition handled with rollback + retry - Double DB queries in cb_router collapsed into single session - user_bot.get_me() result cached at module level - Removed unused imports Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New separate TeleBot instance (TELEGRAM_USER_BOT_TOKEN) running in its own daemon thread alongside the existing admin bot without touching it.
Features:
DB changes:
Bug fixes in bot code:
Made-with: Cursor