Skip to content

Commit 86676d5

Browse files
committed
Merge pull request python-telegram-bot#321 from python-telegram-bot/editMessageText-decorator
Adds @message decorator to editMessageText python-telegram-bot#320
2 parents da95341 + f0b91ec commit 86676d5

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

telegram/bot.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,14 +1009,14 @@ def answerCallbackQuery(self, callback_query_id, text=None, show_alert=False, **
10091009
return result
10101010

10111011
@log
1012+
@message
10121013
def editMessageText(self,
10131014
text,
10141015
chat_id=None,
10151016
message_id=None,
10161017
inline_message_id=None,
10171018
parse_mode=None,
10181019
disable_web_page_preview=None,
1019-
reply_markup=None,
10201020
**kwargs):
10211021
"""Use this method to edit text messages sent by the bot or via the bot
10221022
(for inline bots).
@@ -1043,6 +1043,10 @@ def editMessageText(self,
10431043
A JSON-serialized object for an inline keyboard.
10441044
10451045
Keyword Args:
1046+
reply_markup (Optional[:class:`telegram.ReplyMarkup`]): Additional
1047+
interface options. A JSON-serialized object for an inline
1048+
keyboard, custom reply keyboard, instructions to hide reply
1049+
keyboard or to force a reply from the user.
10461050
timeout (Optional[float]): If this value is specified, use it as
10471051
the definitive timeout (in seconds) for urlopen() operations.
10481052
@@ -1070,15 +1074,8 @@ def editMessageText(self,
10701074
data['parse_mode'] = parse_mode
10711075
if disable_web_page_preview:
10721076
data['disable_web_page_preview'] = disable_web_page_preview
1073-
if reply_markup:
1074-
if isinstance(reply_markup, ReplyMarkup):
1075-
data['reply_markup'] = reply_markup.to_json()
1076-
else:
1077-
data['reply_markup'] = reply_markup
1078-
1079-
result = request.post(url, data, timeout=kwargs.get('timeout'))
10801077

1081-
return Message.de_json(result)
1078+
return url, data
10821079

10831080
@log
10841081
@message

tests/test_photo.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,14 @@ class PhotoTest(BaseTest, unittest.TestCase):
3535

3636
def setUp(self):
3737
self.photo_file = open('tests/data/telegram.jpg', 'rb')
38-
self.photo_file_id = 'AgADAQADvb8xGx8j9QcpZDKxYoFK3bfX1i8ABFX_dgMWoKDuQugAAgI'
38+
self.photo_file_id = 'AgADAQADgEsyGx8j9QfmDMmwkPBrFcKRzy8ABHW8ul9nW7FoNHYBAAEC'
3939
self.photo_file_url = 'https://raw.githubusercontent.com/python-telegram-bot/python-telegram-bot/master/tests/data/telegram.jpg'
4040
self.width = 300
4141
self.height = 300
4242
self.thumb = {
4343
'width': 90,
4444
'height': 90,
45-
'file_id':
46-
'AgADAQADvb8xGx8j9QcpZDKxYoFK3bfX1i8ABBxRLXFhLnhIQ-gAAgI',
45+
'file_id': 'AgADAQADgEsyGx8j9QfmDMmwkPBrFcKRzy8ABD64nkFkjujeNXYBAAEC',
4746
'file_size': 1478
4847
}
4948
self.file_size = 10209

0 commit comments

Comments
 (0)