Spaces:
Running on Zero
Running on Zero
Download app/services/onboarding.py from cipher-attacks/Dbu-central-bot: direct link, hf CLI and curl.
- Browser
- Download file 925 Bytes
-
https://huggingface.co/spaces/cipher-attacks/Dbu-central-bot/resolve/main/app/services/onboarding.py
- Command line
-
hf download hf://spaces/cipher-attacks/Dbu-central-bot/app/services/onboarding.py
-
curl -L -o onboarding.py https://huggingface.co/spaces/cipher-attacks/Dbu-central-bot/resolve/main/app/services/onboarding.py
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 | |