Skip to main content

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.

versions Tests Code Quality codecov PyPI version fury.io license


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'
)

Advanced Example Result


Full documentation and reference are available at telegram-text.alinsky.tech

Release files for telegram_text 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for telegram_text 0.2.0
File Size Uploaded
telegram_text-0.2.0.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for telegram_text 0.2.0
File Interpreter ABI Platform
telegram_text-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / telegram_text-0.2.0.tar.gz

Download URL telegram_text-0.2.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ee295a35f2c77246dd9a80c5e1a8deccc598958dff35740697901c632c6121fa
BLAKE2b-256 checksum
How to use checksums
6ecfb707b994ecb759a533e479e57e59ebcf6e806643fff5a53f05743ae817ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1018-azure

Release files / telegram_text-0.2.0-py3-none-any.whl

Download URL telegram_text-0.2.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5752744dc5f91f3f7f0ec1becbf10adb86d586d9338e0aef74fd76a7261283ca
BLAKE2b-256 checksum
How to use checksums
2a1e88e9126640be7ddfa423d9ae7ac559577ab8877d45e1d32907c02602cdb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1018-azure

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page