Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Корректный вывод строк при большом сообщении #24

Open
mesousabye opened this issue Oct 10, 2024 · 0 comments

Comments

@mesousabye
Copy link

Предлагаю переписать вывод текста в связи с ограничением на 4096 символов следующим образом:
Удалить блок:

                if len(s) > 4096:
                    for x in range(0, len(s), 4096):
                        bot.send_message(message.chat.id, s[x:x + 4096])
                else:
                    bot.send_message(message.chat.id, s)

Переписать блок:

                if not flag:
                    for line in sites:
                        sr = str(s) + '\n' + line.replace("\n", "")
						if sr > 4096:
                            bot.send_message(message.chat.id, s)
                            s = '\n' + line.replace("\n", "")
                        else:
                            s = str(s) + '\n' + line.replace("\n", "")
                bot.send_message(message.chat.id, s)

В таком случае вывод будет именно построчным и не будет ситуаций когда сайт из списка будет разбит на два сообщения.
Надеюсь ничего не напутал, пока на своём не проверял....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant