forked from sass/tipibot
Change exp leveling system
This commit is contained in:
@@ -9,7 +9,7 @@ from discord import app_commands
|
||||
|
||||
from core import sheets
|
||||
import strings as S
|
||||
from core.member_sync import announce_birthday, sync_member
|
||||
from core.member_sync import announce_birthday, sync_member, today_local
|
||||
|
||||
|
||||
class BirthdayPages(discord.ui.View):
|
||||
@@ -44,7 +44,7 @@ def _build_birthday_pages(
|
||||
Returns (pages, start_index) where start_index is the current month.
|
||||
"""
|
||||
rows = sheets.get_cache()
|
||||
today = datetime.date.today()
|
||||
today = today_local()
|
||||
|
||||
by_month: dict[int, list[tuple[int, str, int | None]]] = {m: [] for m in range(1, 13)}
|
||||
|
||||
@@ -298,8 +298,8 @@ def register_dev_member_commands(
|
||||
for fmt in ["%d/%m/%Y", "%Y-%m-%d"]:
|
||||
try:
|
||||
bday = datetime.datetime.strptime(bday_str, fmt).date()
|
||||
if 1920 <= bday.year <= datetime.date.today().year:
|
||||
today = datetime.date.today()
|
||||
if 1920 <= bday.year <= today_local().year:
|
||||
today = today_local()
|
||||
age = today.year - bday.year - ((today.month, today.day) < (bday.month, bday.day))
|
||||
embed.add_field(name=S.MEMBER_UI["age_field"], value=S.MEMBER_UI["age_val"].format(age=age), inline=True)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user