2020-06-14 18:18:29 +03:00
from __future__ import annotations
2023-08-04 00:30:27 +03:00
from typing import TYPE_CHECKING , Any , Optional , Union
2019-11-03 22:14:41 +02:00
2023-07-11 23:39:54 +03:00
from . . types import (
InlineKeyboardMarkup ,
InputMediaAnimation ,
InputMediaAudio ,
InputMediaDocument ,
InputMediaPhoto ,
InputMediaVideo ,
Message ,
)
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 EditMessageMedia ( TelegramMethod [ Union [ Message , bool ] ] ) :
"""
2024-11-02 16:13:45 +02:00
Use this method to edit animation , audio , document , photo , or video messages , or to add media to text messages . If a message is part of a message album , then it can be edited only to an audio for audio albums , only to a document for document albums and to a photo or a video otherwise . When an inline message is edited , a new file can ' t be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
2019-11-03 22:14:41 +02:00
Source : https : / / core . telegram . org / bots / api #editmessagemedia
"""
__returning__ = Union [ Message , bool ]
2023-03-11 20:46:36 +02:00
__api_method__ = " editMessageMedia "
2019-11-03 22:14:41 +02:00
2023-07-11 23:39:54 +03:00
media : Union [
InputMediaAnimation , InputMediaDocument , InputMediaAudio , InputMediaPhoto , InputMediaVideo
]
2019-11-03 22:14:41 +02:00
""" A JSON-serialized object for a new media content of the message """
2024-06-19 00:54:22 +03:00
business_connection_id : Optional [ str ] = None
""" Unique identifier of the business connection on behalf of which the message to be edited was sent """
2019-11-03 22:14:41 +02:00
chat_id : Optional [ Union [ int , str ] ] = None
2021-01-26 21:20:52 +02:00
""" Required if *inline_message_id* is not specified. 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 : Optional [ int ] = None
2021-01-26 21:20:52 +02:00
""" Required if *inline_message_id* is not specified. Identifier of the message to edit """
2019-11-03 22:14:41 +02:00
inline_message_id : Optional [ str ] = None
2021-01-26 21:20:52 +02:00
""" Required if *chat_id* and *message_id* are not specified. Identifier of the inline message """
2019-11-03 22:14:41 +02:00
reply_markup : Optional [ InlineKeyboardMarkup ] = None
2022-11-06 14:28:21 +02:00
""" A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. """
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__ ,
* ,
media : Union [
InputMediaAnimation ,
InputMediaDocument ,
InputMediaAudio ,
InputMediaPhoto ,
InputMediaVideo ,
] ,
2024-06-19 00:54:22 +03:00
business_connection_id : Optional [ str ] = None ,
2023-08-04 00:30:27 +03:00
chat_id : Optional [ Union [ int , str ] ] = None ,
message_id : Optional [ int ] = None ,
inline_message_id : Optional [ str ] = None ,
reply_markup : Optional [ InlineKeyboardMarkup ] = 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__ (
media = media ,
2024-06-19 00:54:22 +03:00
business_connection_id = business_connection_id ,
2023-08-04 00:30:27 +03:00
chat_id = chat_id ,
message_id = message_id ,
inline_message_id = inline_message_id ,
reply_markup = reply_markup ,
* * __pydantic_kwargs ,
)