Move Message redefinitions back to patched

Fixes #1695. This matches the older behaviour better, although the
patched module is now written manually.
This commit is contained in:
Lonami Exo 2021-02-10 20:18:29 +01:00
parent 23041f398b
commit 9a47fdc1ee
2 changed files with 21 additions and 22 deletions

View File

@ -11,7 +11,7 @@ from ... import utils, errors
# 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, TLObject):
"""
This custom class aggregates both :tl:`Message` and
:tl:`MessageService` to ease accessing their members.
@ -1130,22 +1130,3 @@ class _Message(ChatGetter, SenderGetter):
return None
# endregion Private Methods
class MessageEmpty(_Message, types.MessageEmpty):
pass
types.MessageEmpty = MessageEmpty
alltlobjects.tlobjects[MessageEmpty.CONSTRUCTOR_ID] = MessageEmpty
class MessageService(_Message, types.MessageService):
pass
types.MessageService = MessageService
alltlobjects.tlobjects[MessageService.CONSTRUCTOR_ID] = MessageService
class Message(_Message, types.Message):
pass
types.Message = Message
alltlobjects.tlobjects[Message.CONSTRUCTOR_ID] = Message

View File

@ -1,2 +1,20 @@
# Compatibility for people relying on this module
from ..custom.message import MessageEmpty, MessageService, Message
from .. import types, alltlobjects
from ..custom.message import Message as _Message
class MessageEmpty(_Message, types.MessageEmpty):
pass
types.MessageEmpty = MessageEmpty
alltlobjects.tlobjects[MessageEmpty.CONSTRUCTOR_ID] = MessageEmpty
class MessageService(_Message, types.MessageService):
pass
types.MessageService = MessageService
alltlobjects.tlobjects[MessageService.CONSTRUCTOR_ID] = MessageService
class _Message(_Message, types.Message):
pass
Message = _Message
types.Message = Message