Skip to content

Commit

Permalink
Fix docs and imports for custom.Message
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Feb 5, 2021
1 parent 0997e3f commit abe4b8d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions telethon/tl/custom/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# TODO Figure out a way to have the code generator error on missing fields
# Maybe parsing the init function alone if that's possible.
class _Message(ChatGetter, SenderGetter):
class Message(ChatGetter, SenderGetter):
"""
This custom class aggregates both :tl:`Message` and
:tl:`MessageService` to ease accessing their members.
Expand Down Expand Up @@ -1132,9 +1132,9 @@ def _document_by_attribute(self, kind, condition=None):
# endregion Private Methods

def _patch(cls):
# Create new types (classes) for all messages to combine `_Message` in them.
# `_Message` comes first so we get its `__init__`.
newtype = type(cls.__name__, (_Message, cls), {})
# Create new types (classes) for all messages to combine `Message` in them.
# `Message` comes first so we get its `__init__`.
newtype = type(cls.__name__, (Message, cls), {})
setattr(types, cls.__name__, newtype)
# `BinaryReader` directly imports this dictionary, but we're mutating it
# in-place, not replacing it, so it works out to deserialize `newtype`.
Expand All @@ -1145,7 +1145,3 @@ def _patch(cls):
_patch(types.MessageEmpty)
Message = _patch(types.Message)
_patch(types.MessageService)


if TYPE_CHECKING:
Message = _Message

0 comments on commit abe4b8d

Please sign in to comment.