feat: add group duty pin notification feature
All checks were successful
CI / lint-and-test (push) Successful in 23s

- Introduced a new configuration option `DUTY_PIN_NOTIFY` to control whether the bot re-pins the duty message when updated, providing notifications to group members.
- Updated the architecture documentation to reflect the new functionality of re-pinning duty messages.
- Enhanced the `.env.example` file to include the new configuration option with a description.
- Added tests to verify the behavior of the new refresh pin command and its integration with the existing group duty pin functionality.
- Updated internationalization messages to include help text for the new `/refresh_pin` command.
This commit is contained in:
2026-02-23 10:51:47 +03:00
parent 77a94fa91b
commit 8091c608e8
14 changed files with 270 additions and 24 deletions

View File

@@ -56,10 +56,12 @@ def build_team_ics(duties_with_name: list[tuple[Duty, str]]) -> bytes:
"""Build a VCALENDAR (ICS) with one VEVENT per duty for team calendar.
Same structure as personal calendar; PRODID is Team Calendar; each VEVENT
has SUMMARY='Duty' and DESCRIPTION set to the duty holder's full_name.
has SUMMARY set to the duty holder's full_name (or "Duty" if full_name is
empty or missing), and DESCRIPTION set to full_name.
Args:
duties_with_name: List of (Duty, full_name). full_name is used for DESCRIPTION.
duties_with_name: List of (Duty, full_name). full_name is used for
SUMMARY and DESCRIPTION.
Returns:
ICS file content as bytes (UTF-8).
@@ -79,7 +81,8 @@ def build_team_ics(duties_with_name: list[tuple[Duty, str]]) -> bytes:
end_dt = end_dt.replace(tzinfo=timezone.utc)
event.add("dtstart", start_dt)
event.add("dtend", end_dt)
event.add("summary", "Duty")
summary = (full_name or "").strip() or "Duty"
event.add("summary", summary)
event.add("description", full_name)
event.add("uid", f"duty-{duty.id}@duty-teller")
event.add("dtstamp", datetime.now(timezone.utc))