forked from FOSS/AutoShop-Djimbo
feat(referral): add referral system with withdrawals
This commit is contained in:
@@ -5,7 +5,7 @@ from aiogram import Router, Bot, F
|
||||
from aiogram.filters import StateFilter
|
||||
from aiogram.types import CallbackQuery, Message, PreCheckoutQuery
|
||||
|
||||
from tgbot.database import Paymentsx, Refillx, Userx, Settingsx
|
||||
from tgbot.database import Paymentsx, ReferralTransactionx, Refillx, Userx, Settingsx
|
||||
from tgbot.keyboards.inline_user import refill_bill_finl, refill_method_finl
|
||||
from tgbot.services.api_cryptobot import CryptobotAPI
|
||||
from tgbot.services.api_lolzteam import LolzteamAPI
|
||||
@@ -459,4 +459,26 @@ async def save_refill_success(
|
||||
"""),
|
||||
)
|
||||
|
||||
referral_reward = await ReferralTransactionx().get_refill_reward(
|
||||
f"refill:{pay_comment or pay_receipt}"
|
||||
)
|
||||
|
||||
if referral_reward is not None:
|
||||
try:
|
||||
await bot.send_message(
|
||||
referral_reward.user_id,
|
||||
ded(f"""
|
||||
<b>🤝 Реферальное начисление</b>
|
||||
|
||||
▪️ Ваш реферал: <a href='tg://user?id={get_user.user_id}'>{get_user.user_name}</a>
|
||||
▪️ Пополнение: <code>{pay_amount}₽</code>
|
||||
▪️ Начислено: <code>{referral_reward.amount}₽</code>
|
||||
"""),
|
||||
)
|
||||
except Exception:
|
||||
bot_logger.warning(
|
||||
"Не удалось отправить уведомление о реферальном начислении",
|
||||
exc_info=True,
|
||||
)
|
||||
|
||||
return response_success, pay_receipt
|
||||
|
||||
Reference in New Issue
Block a user