skip to Main Content

I’ve already learnt how to edit the message text form this https://telethonn.readthedocs.io/en/latest/telethon.html#telethon.telegram_client.TelegramClient.edit_message.
But how to change photos or some other things?

2

Answers


  1. You’re checking out an unofficial version of the documentation which is very out of date. The official version is TelegramClient.edit_message, which showcases the file parameter:

    await client.edit_message(chat, msg_id, file='example.jpg')
    
    Login or Signup to reply.
  2. messageMini = await client.get_messages(my_channel, ids=14)
    ficheroMini = messageMini.file
    print(messageMini.text) #I see the caption of the image of message 14 in channel
        
    texto = ' random text ' #I must change text every time casue... telethon.errors.rpcerrorlist.MessageNotModifiedError: Content of the message was not modified (caused by EditMessageRequest)
    await client.edit_message(my_channel, mid, texto, file=ficheroMini) #no error: change the caption, but not the image
    #await client.edit_message(my_channel, mid, file='puppy.jpg') #it works: replace image
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search