Thanks to visit codestin.com
Credit goes to github.com

Skip to content

The send_copy method in the Message object does not support link_preview_options #1620

@Peppymiller

Description

@Peppymiller

aiogram version

3.x

Problem

The send_copy method in the Message object does not support link_preview_options

https://github.com/aiogram/aiogram/blob/dev-3.x/aiogram/types/message.py

    def send_copy(  # noqa: C901
        self: Message,
        chat_id: Union[str, int],
        disable_notification: Optional[bool] = None,
        reply_to_message_id: Optional[int] = None,
        reply_parameters: Optional[ReplyParameters] = None,
        reply_markup: Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, None] = None,
        allow_sending_without_reply: Optional[bool] = None,
        message_thread_id: Optional[int] = None,
        business_connection_id: Optional[str] = None,
        parse_mode: Optional[str] = None,
        message_effect_id: Optional[str] = None,
    ) -> ...:

        ...

        kwargs: Dict[str, Any] = {
            "chat_id": chat_id,
            "reply_markup": reply_markup or self.reply_markup,
            "disable_notification": disable_notification,
            "reply_to_message_id": reply_to_message_id,
            "reply_parameters": reply_parameters,
            "message_thread_id": message_thread_id,
            "business_connection_id": business_connection_id,
            "allow_sending_without_reply": allow_sending_without_reply,
            # when sending a copy, we don't need any parse mode
            # because all entities are already prepared
            "parse_mode": parse_mode,
            "message_effect_id": message_effect_id or self.effect_id,
        }
        ...

Possible solution

kwargs: Dict[str, Any] = {
            "chat_id": chat_id,
            "reply_markup": reply_markup or self.reply_markup,
            "disable_notification": disable_notification,
            "reply_to_message_id": reply_to_message_id,
            "reply_parameters": reply_parameters,
            "message_thread_id": message_thread_id,
            "business_connection_id": business_connection_id,
            "allow_sending_without_reply": allow_sending_without_reply,
            # when sending a copy, we don't need any parse mode
            # because all entities are already prepared
            "parse_mode": parse_mode,
            "message_effect_id": message_effect_id or self.effect_id,
            "link_preview_options": self.link_preview_options,
        }

Alternatives

No response

Code example

No response

Additional information

No response

Metadata

Metadata

Assignees

Labels

3.xIssue or PR for stable 3.x versionbugSomething is wrong with the framework

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions