From 85be48f42b03273ea458b7c4db3303ae8b991558 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 2 Apr 2019 08:39:19 +0200 Subject: [PATCH] Document misleading message.out value for events.MessageEdited --- telethon/events/messageedited.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/telethon/events/messageedited.py b/telethon/events/messageedited.py index 3694251f..6a8138a0 100644 --- a/telethon/events/messageedited.py +++ b/telethon/events/messageedited.py @@ -7,6 +7,28 @@ from ..tl import types class MessageEdited(NewMessage): """ Event fired when a message has been edited. + + .. warning:: + + On channels, `Message.out ` + will be ``True`` if you sent the message originally, **not if + you edited it**! This can be dangerous if you run outgoing + commands on edits. + + Some examples follow: + + * You send a message "A", ``out is True``. + * You edit "A" to "B", ``out is True``. + * Someone else edits "B" to "C", ``out is True`` (**be careful!**). + * Someone sends "X", ``out is False``. + * Someone edits "X" to "Y", ``out is False``. + * You edit "Y" to "Z", ``out is False``. + + Since there are useful cases where you need the right ``out`` + value, the library cannot do anything automatically to help you. + Instead, consider using ``from_users='me'`` (it won't work in + broadcast channels at all since the sender is the channel and + not you). """ @classmethod def build(cls, update):