Home > Software engineering >  "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: mes
"A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: mes

Time:12-04

I'm trying to retrieve messages from Reddit subreddits using Error Is there any workaround that I can do possibly do here to access the full message?

CodePudding user response:

One Telegram message must contain no more than 4096 characters. The message is then split into another message (that is, the remainder). Add this code to your message_handler:

m = title   "\n"   post
if len(m) > 4095:
    for x in range(0, len(m), 4095):
        bot.reply_to(message, text=m[x:x 4095])
else:
    bot.reply_to(message, text=m)
  • Related