Merge pull request #218 from Bunk100/patch-1

Update message.py
This commit is contained in:
Alex Root Junior 2019-10-14 23:50:03 +03:00 committed by GitHub
commit 2843a66e61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1567,29 +1567,30 @@ class Message(base.TelegramObject):
async def send_copy(
self: Message,
chat_id: typing.Union[str, int],
with_markup: bool = False,
disable_notification: typing.Optional[bool] = None,
reply_to_message_id: typing.Optional[int] = None,
reply_markup: typing.Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, None] = None,
) -> Message:
"""
Send copy of current message
:param chat_id:
:param with_markup:
:param disable_notification:
:param reply_to_message_id:
:param reply_markup:
:return:
"""
kwargs = {"chat_id": chat_id, "parse_mode": ParseMode.HTML}
kwargs = {
"chat_id": chat_id,
"reply_markup": reply_markup or self.reply_markup,
"parse_mode": ParseMode.HTML
}
text = self.html_text if (self.text or self.caption) else None
if disable_notification is not None:
kwargs["disable_notification"] = disable_notification
if reply_to_message_id is not None:
kwargs["reply_to_message_id"] = reply_to_message_id
if with_markup and self.reply_markup:
kwargs["reply_markup"] = self.reply_markup
text = self.html_text if (self.text or self.caption) else None
if self.text:
return await self.bot.send_message(text=text, **kwargs)