Add SenderGetter to EventCommon

Integrating the `SenderGetter` functionality into the `EventCommon` class, allowing access to sender properties and methods in addition to the existing chat properties and methods.
This commit is contained in:
Serj Berbeha 2024-04-22 20:43:10 +03:00
parent 3625bf849d
commit f9ca093289

View File

@ -5,6 +5,7 @@ import warnings
from .. import utils from .. import utils
from ..tl import TLObject, types from ..tl import TLObject, types
from ..tl.custom.chatgetter import ChatGetter from ..tl.custom.chatgetter import ChatGetter
from ..tl.custom.sendergetter import SenderGetter
async def _into_id_set(client, chats): async def _into_id_set(client, chats):
@ -127,13 +128,14 @@ class EventBuilder(abc.ABC):
return self.func(event) return self.func(event)
class EventCommon(ChatGetter, abc.ABC): class EventCommon(SenderGetter, ChatGetter, abc.ABC):
""" """
Intermediate class with common things to all events. Intermediate class with common things to all events.
Remember that this class implements `ChatGetter Remember that this class implements `ChatGetter
<telethon.tl.custom.chatgetter.ChatGetter>` which <telethon.tl.custom.chatgetter.ChatGetter>` and `SenderGetter
means you have access to all chat properties and methods. <telethon.tl.custom.sendergetter.SenderGetter>` which means you
have access to all their sender and chat properties and methods.
In addition, you can access the `original_update` In addition, you can access the `original_update`
field which contains the original :tl:`Update`. field which contains the original :tl:`Update`.