Implement group duty pinning and user phone management

- Added functionality to pin duty messages in group chats, including scheduling updates and handling bot add/remove events.
- Introduced a new `GroupDutyPin` model to store pinned message details and a `phone` field in the `User` model for user contact information.
- Implemented commands for users to set or clear their phone numbers in private chats.
- Enhanced the repository with functions to manage group duty pins and user phone data.
- Updated handlers to register new commands and manage duty pin updates effectively.
This commit is contained in:
2026-02-18 01:00:31 +03:00
parent 5237262dea
commit 50347038e9
9 changed files with 495 additions and 7 deletions

View File

@@ -0,0 +1,35 @@
"""Group duty pins table and User.phone
Revision ID: 004
Revises: 003
Create Date: 2025-02-18
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = "004"
down_revision: Union[str, None] = "003"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column(
"users",
sa.Column("phone", sa.Text(), nullable=True),
)
op.create_table(
"group_duty_pins",
sa.Column("chat_id", sa.BigInteger(), nullable=False),
sa.Column("message_id", sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint("chat_id"),
)
def downgrade() -> None:
op.drop_table("group_duty_pins")
op.drop_column("users", "phone")