Update with real document_id from the https://t.me/addemoji/RestrictedEmoji emoji pack

Shrimadhav U K 2025-08-29 19:04:46 +05:30
parent 69dbf87c57
commit dc7c168d84

@ -102,7 +102,7 @@ class CustomMarkdown:
This creates a custom class with `parse` and `unparse`. `CustomMarkdown.parse` uses `markdown.parse` (so it works just like the default markdown), but before returning, it scans the parsed text for the following inline URLs: This creates a custom class with `parse` and `unparse`. `CustomMarkdown.parse` uses `markdown.parse` (so it works just like the default markdown), but before returning, it scans the parsed text for the following inline URLs:
```python ```python
message = 'this is a [link text](spoiler) and [❤️](emoji/10002345) too' message = 'this is a [link text](spoiler) and [❤️](emoji/5449505950283078474) too'
``` ```
Here, the message contains a `link text` with URL `spoiler`. The above code will replace the URL with [`MessageEntitySpoiler`](https://tl.telethon.dev/constructors/message_entity_spoiler.html). It also contains a URL with `emoji/10002345`, which will be replaced with [`MessageEntityCustomEmoji`](https://tl.telethon.dev/constructors/message_entity_custom_emoji.html). Effectively sending those instead of the URL. Here, the message contains a `link text` with URL `spoiler`. The above code will replace the URL with [`MessageEntitySpoiler`](https://tl.telethon.dev/constructors/message_entity_spoiler.html). It also contains a URL with `emoji/10002345`, which will be replaced with [`MessageEntityCustomEmoji`](https://tl.telethon.dev/constructors/message_entity_custom_emoji.html). Effectively sending those instead of the URL.
@ -116,7 +116,7 @@ client.parse_mode = CustomMarkdown()
Now, in your message text, you can use inline links which become spoilers and custom emoji! (Note that for custom emoji to work, the inline link text **must** be a normal emoji): Now, in your message text, you can use inline links which become spoilers and custom emoji! (Note that for custom emoji to work, the inline link text **must** be a normal emoji):
```python ```python
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/5449505950283078474) !')
``` ```
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.