Document how to send spoilers and custom emoji

This commit is contained in:
Lonami Exo 2022-10-21 11:12:55 +02:00
parent b3266fabd8
commit 0980d55c34

View File

@ -86,5 +86,40 @@ if you need a more in-depth explanation on how they work. Telethon only needs
you to provide the emoji in some form. Some packages or websites can make this
easier.
Sending spoilers (hidden text)
==============================
The current markdown and HTML parsers do not offer a way to send spoilers yet.
You need to use :tl:`MessageEntitySpoiler` so that parts of the message text
are shown under a spoiler.
The simplest way to do this is to `modify the builtin parsers`_ to support
sending these new message entities with the features they already provide.
Sending custom emoji
====================
The current markdown and HTML parsers do not offer a way to send custom emoji
yet. You need to use :tl:`MessageEntityCustomEmoji` so that parts of the
message text with emoji are replaced with a custom one instead.
The simplest way to do this is to `modify the builtin parsers`_ to support
sending these new message entities with the features they already provide.
:tl:`MessageEntityCustomEmoji` must wrap an emoji in order to work (you can't
put it around arbitrary ``"text"``, it won't work), so be sure to keep this in
mind when using it.
To find the ``document_id`` for the custom emoji, the simplest way is to send
a message with an official client containing the custom emoji you want, and
then print the ``message.entities`` to find the ``document_id``.
If you prefer, you can also use :tl:`GetFeaturedEmojiStickers` to find about
the ``document_id`` of featured custom emoji.
.. _unicode-table.com: https://unicode-table.com/en/emoji/
.. _emoji: https://pypi.org/project/emoji/
.. _modify the builtin parsers: https://github.com/LonamiWebs/Telethon/wiki/Sending-spoilers-and-custom-emoji