From b1cb6b1be873187aa7f6d1ea767c5e9893e36e84 Mon Sep 17 00:00:00 2001 From: Lonami Date: Fri, 21 Jun 2024 21:18:21 +0200 Subject: [PATCH] Move custom parser link to be more prominent --- Sending-more-than-just-messages.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Sending-more-than-just-messages.md b/Sending-more-than-just-messages.md index 8b45d00..7d46efb 100644 --- a/Sending-more-than-just-messages.md +++ b/Sending-more-than-just-messages.md @@ -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. -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 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) !') ``` -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) \ No newline at end of file +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. \ No newline at end of file