Telethon: Can I find the contents of a message with message id and chat_id?.

Created on 11 Apr 2018  路  9Comments  路  Source: LonamiWebs/Telethon


Can I find the contents of a message with message id and chat_id?

Most helpful comment

Yes, you can.

All 9 comments

Yes, you can.

What is the name of the function?

@cho060303 have you tried searching?

I could not find it in the document.
sorry

Thank you. I'll try searching again.

Have you found it yet?

client(AddChatUserRequest(
chat_id,
user_id,
fwd_limit=10
))
i also have an issue like you, where can i find chat_id

@bf-dev here is an example (using bot, mostly the same for client version of the code)

bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN)
result = await bot(functions.messages.GetMessagesRequest(id=[message_id]))
message = result.messages[0]
print(message.text)

Check documentation for more

@ngodanghuuha if you want to get current chat id use get_chat

@bot.on(events.NewMessage)
async def any_message_arrived_handler(event):
    chat = await event.get_chat()
    full_chat = await bot(functions.messages.GetFullChatRequest(
        chat_id=chat.id
    ))

example above shows how to get full chat too which contains a lot of extra information

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ksanderer picture ksanderer  路  3Comments

Lerbytech picture Lerbytech  路  5Comments

Humphry150 picture Humphry150  路  3Comments

chri1389 picture chri1389  路  6Comments

saharokk picture saharokk  路  3Comments