### Install Sulguk with CLI Addons Source: https://github.com/tishka17/sulguk/blob/develop/README.md Installs the 'sulguk' package along with its command-line interface (CLI) addons. This is the primary command for setting up the tool for channel management. ```shell pip install 'sulguk[cli]' ``` -------------------------------- ### Example HTML for Sulguk Conversion Source: https://github.com/tishka17/sulguk/blob/develop/README.md Provides an example of HTML content that can be processed by `sulguk`. This includes ordered lists, paragraphs, and basic formatting tags like bold, demonstrating the input structure `sulguk` is designed to handle. ```html
  1. some item
  2. other item

Some text in a paragraph

``` -------------------------------- ### Basic HTML Formatting for Telegram Source: https://github.com/tishka17/sulguk/blob/develop/README.md Illustrates a simple HTML structure with bold and anchor tags, showcasing the kind of input that `sulguk` can convert to Telegram entities. This example highlights the difference between browser rendering and Telegram's native parsing. ```html This is a demo of Sulguk Underlined Italic Bold ``` -------------------------------- ### Integrate Sulguk with Aiogram (Python) Source: https://github.com/tishka17/sulguk/blob/develop/README.md Shows how to integrate `SulgukMiddleware` into an aiogram bot to automatically handle HTML to Telegram entity conversion using `sulguk`'s custom `parse_mode`. This simplifies message sending for aiogram users. ```python from sulguk import AiogramSulgukMiddleware, SULGUK_PARSE_MODE # Assuming 'bot' is your aiogram Bot instance # bot.session.middleware(AiogramSulgukMiddleware()) # Example of sending a message using the custom parse_mode: # await bot.send_message( # chat_id=CHAT_ID, # text=raw_html, # Your raw HTML content # parse_mode=SULGUK_PARSE_MODE, # ) ``` -------------------------------- ### Convert HTML to Telegram Entities (Python) Source: https://github.com/tishka17/sulguk/blob/develop/README.md Demonstrates the basic usage of the `sulguk` library to transform raw HTML into a format suitable for Telegram messages, including text and entities. This is the core functionality for converting HTML content. ```python from sulguk import transform_html raw_html = """
  1. some item
  2. other item

Some text in a paragraph

""" result = transform_html(raw_html) # To send to Telegram, you might need to convert entities: # await bot.send_message( # chat_id=CHAT_ID, # text=result.text, # entities=result.entities, # ) ``` -------------------------------- ### Set Telegram Bot Token Environment Variable Source: https://github.com/tishka17/sulguk/blob/develop/README.md Configures the necessary environment variable 'BOT_TOKEN' with your Telegram bot's authentication token. This token is required for the 'sulguk' utility to interact with the Telegram API. ```shell export BOT_TOKEN="your telegram token" ``` -------------------------------- ### Send HTML File to Telegram Channel Source: https://github.com/tishka17/sulguk/blob/develop/README.md Sends an HTML file as a message to a specified Telegram channel or chat ID. Additional files are attached as comments to the first file sent. Supports channel names or public links. ```shell sulguk send @chat_id file.html ``` -------------------------------- ### Edit Message or Comment in Telegram Channel Source: https://github.com/tishka17/sulguk/blob/develop/README.md Edits an existing message or comment within a Telegram channel using its provided link. The link can be obtained from the shell or a Telegram client. Supports editing comments as well. ```shell sulguk edit 'https://t.me/channel/1?comment=42' file.html ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.