get the raw tl.Message or tl.MessageService event from a telethon Message object?
I've prodded around, and checked the docs, but can't see a way
for what usecase? telethon patches the original Message with the custom one, it's still a subclass of it, so they're the same thing. you'd need to find original class and serialize it again otherwise
Dumping raw data to dicts. Message.to_dict() doesn't seem to be implemented, and Message also combines both the tl.Message and tl.MessageService objects into one
custom Message inherits everything from TL object one, to_dict() is implemented in both
Hmmm.. does it? I'm sure I was getting NotImplementedError telethon.tl.custom.message.py: class Message(ChatGetter, SenderGetter, TLObject): Has no to_dict() method defined. It composes the tl.Message and tl.MessageService objects, but doesn't inherit from them I think?
telethon.tl.patched is the one used everywhere not the custom
Ohhhh, hmm.. I'm using TelegramClient.iter_messages() and it says it yields custom.Message? And my IDE seems to agree... Are you saying it should be yielding a mix of patched.Message and patched.MessageService then? I may need to double-check later
It always yields patched, since it replaces the telethon.tl.types which is main one. custom is class definition for mutual fields
Ohhh, hmm, well then! I'll have to give that another go this evening and see if it works. Whoops! Thank you
not really a nice way, there's some ugly hacks there
It's fine! I think I can get all I need from what NAME_UNPRONOUNCABLE advised! Don't worry about it
Ah, yup. Can confirm now, that works perfectly!
Обсуждают сегодня