Dbu-central-bot / app /services /onboarding.py
cipher-attacks's picture
english only, full manual, announce
50058db
Raw History Blame Contribute Delete
925 Bytes
"""The moment a student is first seen inside the required channels."""
from aiogram import Bot
from sqlalchemy.ext.asyncio import AsyncSession
from app.db.models import User
from app.services import referrals
from app.services import xp as xp_service
async def mark_passed(session: AsyncSession, bot: Bot, user: User) -> bool:
"""Called for EVERY student who is verified as a member, whether they tapped "I joined" or were
already a member and never saw the gate. Turns on XP/streaks and pays the inviter's join bonus.
(Before this existed only people who tapped the button were counted; everybody who was already in
the channel earned nothing, never became "active" and could not contribute or win.)"""
if user.gate_passed:
return False
user.gate_passed = True
await referrals.reward_if_eligible(session, bot, user)
await xp_service.on_activity(session, user, bot)
return True