Skip to content

Commit 8082a3d

Browse files
committed
Fix wrong Message.forward_from with signed channel posts
Before this commit, Message.forward_from returned the user who signed the post with signed channel posts instead of the channel. This wrong behavior is now fixed. Fixes: GH-80
1 parent 533a81c commit 8082a3d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

botogram/objects/messages.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,13 @@ def __init__(self, data, api=None):
387387
def forward_from(self):
388388
"""Get from where the message was forwarded"""
389389
# Provide either _forward_from or _forward_from_chat
390-
if self._forward_from is not None:
391-
return self._forward_from
392-
390+
# _forward_from_chat is checked earlier because it's more correct
393391
if self._forward_from_chat is not None:
394392
return self._forward_from_chat
395393

394+
if self._forward_from is not None:
395+
return self._forward_from
396+
396397
@property
397398
@utils.deprecated("Message.new_chat_participant", "1.0",
398399
"Rename property to Message.new_chat_member")

docs/changelog/0.4.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ Bug fixes
7070

7171
* Fix inability to fetch updates and stop the runner after an internet
7272
connection outage.
73+
* Fix :py:attr:`botogram.Message.forward_from` giving wrong information with
74+
signed channel posts (`issue 80`_)
75+
76+
.. _issue 80: https://github.com/pietroalbini/botogram/issues/80
77+
7378

7479
Deprecated features
7580
-------------------

0 commit comments

Comments
 (0)