Skip to content

Commit

Permalink
remove donation handling from central
Browse files Browse the repository at this point in the history
  • Loading branch information
Furrior committed Feb 2, 2025
1 parent 958ac06 commit 35d270f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 38 deletions.
6 changes: 0 additions & 6 deletions app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,10 @@ class OAuth(CustomBaseModel):
client_id: int = 12345678


class Game(CustomBaseModel):
donation_wls: list[str] = ["prime", "devtest"]
paid_wl_min_tier: int = 2
bot_id: int = 1

class Config(CustomBaseModel):
general: General = General()
database: Database = Database()
oauth: OAuth = OAuth()
game: Game = Game()


def parse_config(f: BufferedReader) -> Config:
Expand Down
25 changes: 0 additions & 25 deletions app/routes/v1/donate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,6 @@ def filter_donations(selection: SelectOfScalar[Donation], ckey: str | None = Non
selection = selection.where(Donation.valid)
return selection

async def handle_donation(session: SessionDep, donation: Donation):
if donation.tier < CONFIG.game.paid_wl_min_tier:
return
# Auto wls on donation
paid_wl_types = CONFIG.game.donation_wls
for paid_wl in paid_wl_types:
new_wl = NewWhitelistInternal(
player_id=donation.player_id,
wl_type=paid_wl,
admin_id=CONFIG.game.bot_id, # system user or idk
duration_days=DEFAULT_DONATION_EXPIRATION_TIME.days,
valid=True
)
try:
wl = await create_whitelist(session, new_wl, ignore_bans=False)
logger.info("Player %s got wl %s via donation %s.", donation.player_id, wl.id, donation.id)
except HTTPException as e:
if e.status_code == status.HTTP_409_CONFLICT:
logger.debug("Player %s couldnt get wl to %s via donation %s due to wl ban.", donation.player_id, paid_wl, donation.id)
continue
raise e



@router.get("", status_code=status.HTTP_200_OK)
async def get_donations(session: SessionDep,
Expand All @@ -71,8 +48,6 @@ async def create_donation(session: SessionDep, donation: Donation) -> Donation:

logger.info("Donation created: %s", donation.model_dump_json())

await handle_donation(session, donation)

return donation

WHITELIST_POST_RESPONSES = {
Expand Down
7 changes: 0 additions & 7 deletions config_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,3 @@ client_id = 12345678
#project_ver = "0.1.0"
endpoint_url = "http://127.0.0.1:8000"
favicon_path = "app/assets/favicon.png"

[game]
# Gives these wls on donation of specific tier or above
donation_wls = ["prime", "devtest"]
paid_wl_min_tier = 2
# This user will be the admin for donation wls. Uses internal user id
bot_id = 1

0 comments on commit 35d270f

Please sign in to comment.