Hello! I want to table a proposal to add a special submodule to generate Telegram-specific markup easily.
Motivation
A common markdown format that every programmer uses is really simple and doesn’t require special utils for that, but MarkdownV2 and HTML which let include spoiler, strikethrough and other telegram innovations are different. For example, MarkdownV2 also requires to escape 18 characters, and if it’s not, reject the request. This may make the task of designing markup generation for bots that include business logic complicated enough and I suppose it’s better to have a ready-made out-of-the-box solution for this.
Implementation suggestion
General explanation
I have recently worked on a related challenge and I’m writing this to propose to re-use my solution. It’s the telegram-text module. The general structure in the context of the origamibot module I propose to implement is the following:
Add telegram-text as a dependency (maybe even optional)
Add support for message objects rendering depending on format mode (Markdown / MarkdownV2 / HTML) inside the message sending function
Add imports into the origamibot module core to import styles and other needed classes as from origamibot import .... Or it’s quite pretty to add a separated file (text.py or markup.py for example) to import as from origamibot.text import ...
Hello! I want to table a proposal to add a special submodule to generate Telegram-specific markup easily.
Motivation
A common markdown format that every programmer uses is really simple and doesn’t require special utils for that, but MarkdownV2 and HTML which let include spoiler, strikethrough and other telegram innovations are different. For example, MarkdownV2 also requires to escape 18 characters, and if it’s not, reject the request. This may make the task of designing markup generation for bots that include business logic complicated enough and I suppose it’s better to have a ready-made out-of-the-box solution for this.
Implementation suggestion
General explanation
I have recently worked on a related challenge and I’m writing this to propose to re-use my solution. It’s the
telegram-text
module. The general structure in the context of theorigamibot
module I propose to implement is the following:telegram-text
as a dependency (maybe even optional)origamibot
module core to import styles and other needed classes asfrom origamibot import ...
. Or it’s quite pretty to add a separated file (text.py
ormarkup.py
for example) to import asfrom origamibot.text import ...
Why
telegram-text
module?Example of the module:
Usage example in the
origamibot
context