Move custom parser link to be more prominent

Lonami 2024-06-21 21:18:21 +02:00
parent ce64dbacf2
commit b1cb6b1be8

@ -72,7 +72,7 @@ Telethon's v1 `markdown` parser does not offer a way to send spoiler (hidden tex
Telethon's [`parse_mode`](https://docs.telethon.dev/en/stable/modules/client.html#telethon.client.messageparse.MessageParseMethods.parse_mode) supports using a custom object with `parse` and `unparse` functions to work. This means it's possible to leverage the current markdown implementation and extend it with custom functionality. Telethon's [`parse_mode`](https://docs.telethon.dev/en/stable/modules/client.html#telethon.client.messageparse.MessageParseMethods.parse_mode) supports using a custom object with `parse` and `unparse` functions to work. This means it's possible to leverage the current markdown implementation and extend it with custom functionality.
Copy the following code into your own: There are [third-party parsers for HTML](https://gist.github.com/YouKnow-sys/3d571bdd4857f175d91db8146ec065bf) that support more of the tags allowed by the HTTP bot API, including spoilers and custom emoji. Alternatively, you can copy the (less powerful) following code into your own:
```python ```python
from telethon.extensions import markdown from telethon.extensions import markdown
@ -119,6 +119,4 @@ Now, in your message text, you can use inline links which become spoilers and cu
client.send_message('me', 'hello this is a [hidden text](spoiler), with custom emoji [❤️](emoji/10002345) !') client.send_message('me', 'hello this is a [hidden text](spoiler), with custom emoji [❤️](emoji/10002345) !')
``` ```
You may have noticed the emoji URL is followed by a number. This number is a `document_id`. To find it, the easiest way is to send a message to your own chat with the premium emoji you want to use using an official client, and then use Telethon to print the `message.entities`. It will contain the `document_id` you need to use. You may have noticed the emoji URL is followed by a number. This number is a `document_id`. To find it, the easiest way is to send a message to your own chat with the premium emoji you want to use using an official client, and then use Telethon to print the `message.entities`. It will contain the `document_id` you need to use.
You can find a custom HTML **parser example** that have both spoilers and custom emojis [Here](https://gist.github.com/YouKnow-sys/3d571bdd4857f175d91db8146ec065bf)