mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
feat: TelegramObject readable representation (#796)
This commit is contained in:
parent
763efb7763
commit
583f00ce31
1 changed files with 9 additions and 0 deletions
|
|
@ -211,6 +211,15 @@ class TelegramObject(ContextInstanceMixin, metaclass=MetaTelegramObject):
|
||||||
"""
|
"""
|
||||||
return self.as_json()
|
return self.as_json()
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
"""
|
||||||
|
Return object readable representation.
|
||||||
|
|
||||||
|
Example: <ObjectName {"id": 123456}>
|
||||||
|
:return: object class name and object data as a string
|
||||||
|
"""
|
||||||
|
return f"<{type(self).__name__} {self}>"
|
||||||
|
|
||||||
def __getitem__(self, item: typing.Union[str, int]) -> typing.Any:
|
def __getitem__(self, item: typing.Union[str, int]) -> typing.Any:
|
||||||
"""
|
"""
|
||||||
Item getter (by key)
|
Item getter (by key)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue