Skip to content

Commit 135b24a

Browse files
authored
Message.edit_attach bugfix (#127)
* Fix Message.edit_attach mixin * Add changelog
1 parent cffcfb2 commit 135b24a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

botogram/objects/mixins.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,11 @@ def edit_caption(self, caption, extra=None, attach=None, *, syntax=None):
448448
def edit_attach(self, attach):
449449
"""Edit this message's attachment"""
450450
args = {"message_id": self.id, "chat_id": self.chat.id}
451-
args["reply_markup"] = attach
451+
if not hasattr(attach, "_serialize_attachment"):
452+
raise ValueError("%s is not an attachment" % attach)
453+
args["reply_markup"] = json.dumps(attach._serialize_attachment(
454+
self.chat
455+
))
452456

453457
self._api.call("editMessageReplyMarkup", args)
454458

docs/changelog/0.7.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ New features
3535

3636
Bug fixes
3737
---------
38+
39+
* Fixed :py:meth:`botogram.Message.edit_attach` to work with inline callbacks

0 commit comments

Comments
 (0)