Telegram allows including animated and static custom emojis inside of messages.
messageEntityCustomEmoji#c8cf05f8 offset:int length:int document_id:long = MessageEntity;
document#8fd4c4d8 flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:long thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;
documentAttributeCustomEmoji#fd149899 flags:# free:flags.0?true alt:string stickerset:InputStickerSet = DocumentAttribute;
---functions---
messages.getCustomEmojiDocuments#d9ab0f54 document_id:Vector<long> = Vector<Document>;
Custom emojis are a special kind of entity », containing just a document_id
, which can be passed to messages.getCustomEmojiDocuments to fetch the static, animated or video sticker emoji that should be displayed to the user as described in the stickers documentation.
Custom emoji documents will contain documentAttributeCustomEmoji attribute instead of a documentAttributeSticker, containing information on the associated emoji (alt
), whether the emoji can be used by non-premium users (free
) and the associated stickerset
.
Note that when sending messages with attached custom emojis, the messageEntityCustomEmoji entity » must wrap exactly one regular emoji (the one contained in documentAttributeCustomEmoji.alt
) in the related text, otherwise the server will ignore it.
Like stickers, custom emojis are organized in stickersets: see the stickers documentation » for more info on how to work with them.
To send a message with one or more custom emojis, create and attach messageEntityCustomEmoji entities » to a message.
Note that you can attach a maximum of message_animated_emoji_max
custom emojis, as specified by the appConfig field ».