Search code examples
pythonapimarkdowntelegrammessage

Telegram API message error, how avoid words missing


I try to send a telegram message from python through the api, the message is a preformed text like the following:

message = (f"```test: Hello World \n"
           f"time : {datetime.datetime.now()}```")

but I only receive the following in the telegram bot:

enter image description here

As you can see in the image, the word test: is missing

From now, thank you for you help guys!


Solution

  • Add a newline(\n) after the markdown syntax:

    message = (f"```\ntest: Hello World \n"
               f"time : {datetime.datetime.now()}```")