paper-dynasty-discord/utilities/evolution_notifications.py
Cal Corum 208efd11a6
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m25s
feat: tier completion notification embeds (WP-14) (#79)
Closes paper-dynasty-database#79

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:34:14 -05:00

60 lines
1.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import discord
# Tier colors as Discord embed color integers
TIER_COLORS = {
1: 0x57F287, # green
2: 0xF1C40F, # gold
3: 0x9B59B6, # purple
4: 0x1ABC9C, # teal
}
MAX_TIER = 4
def tier_up_embed(
player_name: str, tier: int, tier_name: str, track_name: str
) -> discord.Embed:
"""
Build a Discord embed for a single evolution tier-up event.
For tier 4 (fully evolved), uses a distinct title, description, and footer.
For tiers 13, uses the standard tier-up format.
"""
color = TIER_COLORS.get(tier, 0xFFFFFF)
if tier == MAX_TIER:
embed = discord.Embed(
title="FULLY EVOLVED!",
description=f"{player_name} has reached maximum evolution on the {track_name} track",
color=color,
)
embed.set_footer(text="Rating boosts coming in a future update!")
else:
embed = discord.Embed(
title="Evolution Tier Up!",
description=f"{player_name} reached Tier {tier} ({tier_name}) on the {track_name} track",
color=color,
)
return embed
def build_tier_embeds(tier_ups: list) -> list:
"""
Build a list of Discord embeds for all tier-up events in a game.
Each item in tier_ups should be a dict with keys:
player_name (str), tier (int), tier_name (str), track_name (str)
Returns an empty list if there are no tier-ups.
"""
return [
tier_up_embed(
player_name=t["player_name"],
tier=t["tier"],
tier_name=t["tier_name"],
track_name=t["track_name"],
)
for t in tier_ups
]