nickoala / telepot

Python framework for Telegram Bot API
MIT License
2.43k stars 474 forks source link

Keep Words Together with No Break #428

Open hyperdesignbot opened 5 years ago

hyperdesignbot commented 5 years ago

Hello I want to use forward slash in text and send this text with telegram bot. text = 's://someword' bot.sendMessage(chat_id,text) Everything is OK when i use some word, but when i use many too words, it makes newline after forward slash ('/'). I want to keep words together with no break with use forward slash in text. I try parsemode = 'HTML' and parsemode='Markdown' with any good result.

tasi788 commented 5 years ago

I suggest that use html parse mode is better then markdown (in some case.)

from html import escape

text = escape('s://someword')
bot.sendMessage(chat_id, text, parse_mode='html')
hyperdesignbot commented 5 years ago

It works for some words, when the text is long, it makes a new line between 's://' and long text. I want to prevent this break and keep them together with no break.