I need to get some data about one chat (that is a group or a channel)
the data I want from chat is: chat id chat name chat type (group / channel , public / private) chat members etc...
I made already a function that takes the needed data from a dialog object.
but to get a dialog object of a chat I must get all chats, so is there any way I can get a dialog object of just one chat / turn a chat entity into a dialog object?
CodePudding user response:
You don't need a Dialog
object to get the information you have mentioned. they're all available in the Channel
object. so you must be having an input entity. you can first do:
entity = client.get_entity(<anything you had before>) # to confirm you have full info
you can see the link above or print(entity.stringify())
to get the desired fields.
the unobvious ones can be:
entity.megagroup
: a group.entity.broadcast
: a channel.not entity.username
: private.
to get memebers is a whole different thing, check out client.get_participants