forked from sass/tipibot
Fix birthday bug
This commit is contained in:
@@ -236,7 +236,7 @@ def register_dev_member_commands(
|
||||
else:
|
||||
already_ok += 1
|
||||
|
||||
if result.birthday_soon and not has_announced_today(member.id):
|
||||
if result.birthday_today and not has_announced_today(member.id):
|
||||
birthday_pings += 1
|
||||
await announce_birthday(member, bot)
|
||||
mark_announced_today(member.id)
|
||||
|
||||
@@ -88,6 +88,6 @@ async def handle_member_join(
|
||||
log_sync_result(member, result)
|
||||
await sheets.set_synced(member.id, result.synced)
|
||||
|
||||
if result.birthday_soon and not has_announced_today(member.id):
|
||||
if result.birthday_today and not has_announced_today(member.id):
|
||||
await announce_birthday(member, bot)
|
||||
mark_announced_today(member.id)
|
||||
|
||||
@@ -34,6 +34,7 @@ class SyncResult:
|
||||
roles_added: list[str] = field(default_factory=list)
|
||||
roles_removed: list[str] = field(default_factory=list)
|
||||
birthday_soon: bool = False
|
||||
birthday_today: bool = False
|
||||
not_found: bool = False
|
||||
errors: list[str] = field(default_factory=list)
|
||||
synced: bool = False # True when no errors; caller writes this to the sheet
|
||||
@@ -186,8 +187,9 @@ async def sync_member(
|
||||
|
||||
# --- Birthday check ---
|
||||
birthday_str = str(row.get("Sünnipäev", "")).strip()
|
||||
if not _is_placeholder(birthday_str) and _is_birthday_soon(birthday_str):
|
||||
result.birthday_soon = True
|
||||
if not _is_placeholder(birthday_str):
|
||||
result.birthday_today = is_birthday_today(birthday_str)
|
||||
result.birthday_soon = _is_birthday_soon(birthday_str)
|
||||
|
||||
# --- Mark synced (caller is responsible for writing to sheet) ---
|
||||
result.synced = not bool(result.errors)
|
||||
|
||||
Reference in New Issue
Block a user