J'essaie d'obtenir le nom du canal par canal ID:Comment obtenir le canal/le chat/le nom d'utilisateur du message transféré en utilisant le Téléthon?
result = self._client(GetHistoryRequest(
entity,
limit=100,
offset_date=None,
offset_id=0,
max_id=0,
min_id=last_read_message_id,
add_offset=0
))
for message in result.messages:
if isinstance(message.fwd_from, MessageFwdHeader):
fwd_channel_id = message.fwd_from.channel_id
if fwd_channel_id:
fwd_result = self._client(GetFullChannelRequest(# problem!!!
InputPeerChannel(message.fwd_from.channel_id, 0)
))
message.fwd_from
ressemble:
fwd_from=MessageFwdHeader(
channel_id=1053596007,
date=datetime.fromtimestamp(1507891987.0),
post_author=None, # None!!!
from_id=None,
channel_post=3030
),
Donc, je ne peux pas prendre le nom du canal de message.fwd_from
. Et je ne suis pas membre de ce canal.
Quand je tente d'appeler GetFullChannelRequest
, j'ai erreur suivante:
ChannelInvalidError(...), 'Invalid channel object. Make sure to pass the right types, for instance making sure that the request is designed for channels or otherwise look for a different one more suited.'
Comment obtenir le nom du canal correctement?