Python markup module for Telegram messenger. This module provides a rich list of components to build any possible markup fast and render it to specific html or MarkdownV2 formats.
Project description
telegram-text
Python markup module for Telegram messenger. This module provides a rich list of components to build any possible markup fast and render it to specific html and MarkdownV2 formats.
Installation
Install using pip install telegram-text
or poetry add telegram-text
Also, telegram-text
is integrated into following packages:
Module | Installation | Import | Documentation |
---|---|---|---|
python-telegram | pip install python-telegram |
from telegram.text import ... |
Readme |
OrigamiBot | pip install origamibot[telegram-text] |
from origamibot.text import ... |
Release |
TGramBot | pip install tgrambot |
from tgrambot.text import ... |
Readme |
Basic Example
from telegram_text import Bold, Italic, Underline
text = Underline(Bold("Bold") + "and" + Italic("italic") + "with underline.")
Advanced Example
from telegram_text import Bold, Chain, Italic, TOMLSection, Hashtag, Link, UnorderedList
description = "A Channel about software developing and distributing. Subscribe to follow new technologies."
tags: dict[str, str] = {...} # Tags description with following format `tag: tag_description`
links: dict[str, str] = {...} # Links with following format `text: url`
menu = Chain(
TOMLSection(
'Menu',
Italic(description),
),
TOMLSection(
'Tags',
*[Hashtag(tag, style=Bold) + f"- {about}" for tag, about in tags.items()],
),
TOMLSection(
'Links',
UnorderedList(*[Link(text, url) for text, url in links.items()]),
),
sep='\n\n'
)
Full documentation and reference are available at telegram-text.alinsky.tech
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
telegram_text-0.2.0.tar.gz
(7.9 kB
view hashes)
Built Distribution
Close
Hashes for telegram_text-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5752744dc5f91f3f7f0ec1becbf10adb86d586d9338e0aef74fd76a7261283ca |
|
MD5 | 1cdce1d15f7d95629c57d70863b1a629 |
|
BLAKE2b-256 | 2a1e88e9126640be7ddfa423d9ae7ac559577ab8877d45e1d32907c02602cdb3 |