K
K
kr_ilya2019-07-18 11:08:21
Python
kr_ilya, 2019-07-18 11:08:21

How to make the bot forward the message sent to it?

I use the telethon library to send a video to a chat with a bot.

from telethon import TelegramClient, sync

client = TelegramClient('session_upload', api_id, api_hash)
client.start()

rres = client.send_file('bot_bot (ник бота)', filePath, part_size_kb=512, caption=text, thumb=imgPath, supports_streaming=True)
print(rres)

I receive in response

Message(fwd_from=None, out=True, reply_markup=None, id=1649, post_author=None, media=MessageMediaDocument(document=Document(dc_id=2, attributes=[DocumentAttributeVideo(h=1, round_message=False, supports_streaming=True, duration=0, w=1), DocumentAttributeFilename(file_name='123.mp4')], thumbs=[PhotoStrippedSize(bytes=b"!\xb1Z\xd1\x1c\x0\x8a\x976\x8a\xab\xb8pEWDfq\x81\xd2\xb4\xeepc#\xda\xaa\xda\x8f\x97\x9aw\xd0,G.v\x10h\xa9g\x07f", type='i'), PhotoSize(h=135, location=FileLocationToBeDeprecated(local_id=44760, volume_id=263719292), size=5006, type='m', w=180)], mime_type='video/mp4', file_reference=b'\x03\x00\x00\x5\x08L\xc9=\rlI\xee_r\x95M\xe8', id=5296747174883754960, size=11122922, access_hash=522978512391, date=datetime.datetime(2019, 7, 18, 6, 59, 10, tzinfo=datetime.timezone.utc)), ttl_seconds=None), mentioned=False, via_bot_id=None, post=False, message='123', silent=False, from_scheduled=False, legacy=False, entities=[], media_unread=False, reply_to_msg_id=None, views=None, to_id=PeerUser(user_id=761059914), edit_date=None, grouped_id=None, from_id=700, date=datetime.datetime(2019, 7, 18, 6, 59, 10, tzinfo=datetime.timezone.utc))


Next, I try to forward the message by id from the response (1649)
import requests

response = requests.get('https://api.telegram.org/bot123:123-E/forwardMessage?chat_id=-1111(id канала)&[email protected]_bot (ник бота)&message_id=1649')
print (response.json())

I get this in response
{"ok":false,"error_code":400,"description":"Bad Request: chat not found"}

The bot's nickname is correct, as well as the channel id
How do I forward the message?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2019-07-18
@dimonchik2013

who is the bot sending to? bot only to the client, no other bot

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question