Issue
i would like to know how can i forward a message from a given channel id with the message number ( like when you copy the message link from inside the telegram itself) to a given group join link using messages.forwardMessage from telegram API funtion?
i.e: this is my join link of the destination:
https://t.me/joinchat/AAAAAAlw6NYyLMlMES5hbw
and this is the message which should be forwarded to that above link: https://t.me/kjdfvbjkdfbvkj/3
Thank you ( esp to @apadana )
Solution
Here is how to forward from a group (not supergroup) to a channel. If you are looking for something else please comment.
#testChannel
source_chat_id=12345
source_access_hash=1234567890
source_chat = InputPeerChannel(source_chat_id, source_access_hash)
#testGroup:
dest_chat_id = 123456
# chat = InputPeerChannel(chat_id, access_hash)
total_count, messages, senders = client.get_message_history(
source_chat, limit=10)
msg = messages[0]
dest_chat = InputPeerChat(dest_chat_id)
result = client.invoke(ForwardMessagesRequest(from_peer=source_chat, id=[msg.id], random_id=[generate_random_long()], to_peer=dest_chat))
Answered By - apadana Answer Checked By - David Marino (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.