2020-06-14 18:18:29 +03:00
from __future__ import annotations
2025-03-08 02:19:57 +02:00
from typing import TYPE_CHECKING , Any , Optional
2019-11-03 22:14:41 +02:00
2025-03-08 02:19:57 +02:00
from . . types import ChatIdUnion
2023-03-11 20:46:36 +02:00
from . base import TelegramMethod
2020-06-14 18:18:29 +03:00
2019-11-03 22:14:41 +02:00
class PinChatMessage ( TelegramMethod [ bool ] ) :
"""
2021-11-08 02:37:37 +02:00
Use this method to add a message to the list of pinned messages in a chat . If the chat is not a private chat , the bot must be an administrator in the chat for this to work and must have the ' can_pin_messages ' administrator right in a supergroup or ' can_edit_messages ' administrator right in a channel . Returns : code : ` True ` on success .
2019-11-03 22:14:41 +02:00
Source : https : / / core . telegram . org / bots / api #pinchatmessage
"""
__returning__ = bool
2023-03-11 20:46:36 +02:00
__api_method__ = " pinChatMessage "
2019-11-03 22:14:41 +02:00
2025-03-08 02:19:57 +02:00
chat_id : ChatIdUnion
2021-01-26 21:20:52 +02:00
""" Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) """
2019-11-03 22:14:41 +02:00
message_id : int
""" Identifier of a message to pin """
2024-08-09 19:10:39 +03:00
business_connection_id : Optional [ str ] = None
""" Unique identifier of the business connection on behalf of which the message will be pinned """
2019-11-03 22:14:41 +02:00
disable_notification : Optional [ bool ] = None
2022-08-14 16:32:29 +03:00
""" Pass :code:`True` if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats. """
2023-08-04 00:30:27 +03:00
if TYPE_CHECKING :
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__ (
__pydantic__self__ ,
* ,
2025-03-08 02:19:57 +02:00
chat_id : ChatIdUnion ,
2023-08-04 00:30:27 +03:00
message_id : int ,
2024-08-09 19:10:39 +03:00
business_connection_id : Optional [ str ] = None ,
2023-08-04 00:30:27 +03:00
disable_notification : Optional [ bool ] = None ,
* * __pydantic_kwargs : Any ,
) - > None :
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super ( ) . __init__ (
chat_id = chat_id ,
message_id = message_id ,
2024-08-09 19:10:39 +03:00
business_connection_id = business_connection_id ,
2023-08-04 00:30:27 +03:00
disable_notification = disable_notification ,
* * __pydantic_kwargs ,
)