Skip to content

Commit

Permalink
Add missing schedule_date to edit_message methods
Browse files Browse the repository at this point in the history
  • Loading branch information
KurimuzonAkuma committed Dec 15, 2023
1 parent fc17edf commit f72a19f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pyrogram/methods/messages/edit_message_caption.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.

from datetime import datetime
from typing import Union, List, Optional

import pyrogram
Expand All @@ -30,6 +31,7 @@ async def edit_message_caption(
caption: str,
parse_mode: Optional["enums.ParseMode"] = None,
caption_entities: List["types.MessageEntity"] = None,
schedule_date: datetime = None,
reply_markup: "types.InlineKeyboardMarkup" = None
) -> "types.Message":
"""Edit the caption of media messages.
Expand All @@ -55,6 +57,9 @@ async def edit_message_caption(
caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
An InlineKeyboardMarkup object.
Expand All @@ -72,5 +77,6 @@ async def edit_message_caption(
text=caption,
parse_mode=parse_mode,
entities=caption_entities,
schedule_date=schedule_date,
reply_markup=reply_markup
)
6 changes: 6 additions & 0 deletions pyrogram/methods/messages/edit_message_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.

from datetime import datetime
import io
import os
import re
Expand All @@ -35,6 +36,7 @@ async def edit_message_media(
message_id: int,
media: "types.InputMedia",
invert_media: bool = None,
schedule_date: datetime = None,
reply_markup: "types.InlineKeyboardMarkup" = None,
file_name: str = None
) -> "types.Message":
Expand All @@ -60,6 +62,9 @@ async def edit_message_media(
invert_media (``bool``, *optional*):
Invert media.
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
An InlineKeyboardMarkup object.
Expand Down Expand Up @@ -277,6 +282,7 @@ async def edit_message_media(
id=message_id,
invert_media=invert_media,
media=media,
schedule_date=utils.datetime_to_timestamp(schedule_date),
reply_markup=await reply_markup.write(self) if reply_markup else None,
message=message,
entities=entities
Expand Down
7 changes: 7 additions & 0 deletions pyrogram/methods/messages/edit_message_reply_markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.

from datetime import datetime
from typing import Union

import pyrogram
from pyrogram import raw
from pyrogram import types
from pyrogram import utils


class EditMessageReplyMarkup:
async def edit_message_reply_markup(
self: "pyrogram.Client",
chat_id: Union[int, str],
message_id: int,
schedule_date: datetime = None,
reply_markup: "types.InlineKeyboardMarkup" = None,
) -> "types.Message":
"""Edit only the reply markup of messages sent by the bot.
Expand All @@ -43,6 +46,9 @@ async def edit_message_reply_markup(
message_id (``int``):
Message identifier in the chat specified in chat_id.
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
An InlineKeyboardMarkup object.
Expand All @@ -64,6 +70,7 @@ async def edit_message_reply_markup(
raw.functions.messages.EditMessage(
peer=await self.resolve_peer(chat_id),
id=message_id,
schedule_date=utils.datetime_to_timestamp(schedule_date),
reply_markup=await reply_markup.write(self) if reply_markup else None,
)
)
Expand Down
6 changes: 6 additions & 0 deletions pyrogram/methods/messages/edit_message_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.

from datetime import datetime
from typing import Union, List, Optional

import pyrogram
Expand All @@ -33,6 +34,7 @@ async def edit_message_text(
parse_mode: Optional["enums.ParseMode"] = None,
entities: List["types.MessageEntity"] = None,
disable_web_page_preview: bool = None,
schedule_date: datetime = None,
reply_markup: "types.InlineKeyboardMarkup" = None
) -> "types.Message":
"""Edit the text of messages.
Expand Down Expand Up @@ -61,6 +63,9 @@ async def edit_message_text(
disable_web_page_preview (``bool``, *optional*):
Disables link previews for links in this message.
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
An InlineKeyboardMarkup object.
Expand All @@ -84,6 +89,7 @@ async def edit_message_text(
peer=await self.resolve_peer(chat_id),
id=message_id,
no_webpage=disable_web_page_preview or None,
schedule_date=utils.datetime_to_timestamp(schedule_date),
reply_markup=await reply_markup.write(self) if reply_markup else None,
**await utils.parse_text_entities(self, text, parse_mode, entities)
)
Expand Down

0 comments on commit f72a19f

Please sign in to comment.