TGPy icon indicating copy to clipboard operation
TGPy copied to clipboard

Do not show all fields in tl objects when they are returned

Open vanutp opened this issue 4 years ago • 0 comments

For example, when message is sent using await msg.reply('123'), Message object is returned and a lot of fields are shown, spamming in the chat.

For instance:

msg
TGPy> Message(
 id=123,
 peer_id=PeerChannel(
  channel_id=1123456789
 ),
 date=datetime.datetime(2021, 11, 18, 18, 7, 4, tzinfo=datetime.timezone.utc),
 message='msg',
 out=True,
 mentioned=False,
 media_unread=False,
 silent=False,
 post=False,
 from_scheduled=False,
 legacy=False,
 edit_hide=False,
 pinned=False,
 from_id=PeerUser(
  user_id=123456
 ),
 fwd_from=None,
 via_bot_id=None,
 reply_to=None,
 media=None,
 reply_markup=None,
 entities=[
 ],
 views=None,
 forwards=None,
 replies=MessageReplies(
  replies=0,
  replies_pts=...,
  comments=False,
  recent_repliers=[
  ],
  channel_id=None,
  max_id=None,
  read_max_id=None
 ),
 edit_date=None,
 post_author=None,
 grouped_id=None,
 restriction_reason=[
 ],
 ttl_period=None
)

Proposal is to show only commonly used fields, such as id, text, date, fwd_from, etc. Also, this could be done for User, Channel, Chat too

vanutp avatar Nov 18 '21 18:11 vanutp