Skip to content

Proposition to use unicode emojies in messageAnimatedEmoji if variable telega-emoji-use-images is nil #522

@lumpsoid

Description

@lumpsoid

Issue description
Currently, the telega-ins--animated-emoji-msg function ignores the telega-emoji-use-images variable setting when handling messages with only one emoji as content. Even when telega-emoji-use-images is set to nil, animated emojis are still rendered as SVG images instead of plain unicode text.

When a user sends a message with only one emoji, it will be rendered as an SVG image (handled by telega-ins--animated-emoji-msg function). If a user sends the message containing both text and emoji, then it renders as unicode emoji as expected, in context when telega-emoji-use-images is set to nil.

Expected behavior
When telega-emoji-use-images is set to nil, all emojis (including those in animated emoji messages) should be displayed as plain unicode text characters.

Proposed solution
Add a condition to check the value of telega-emoji-use-images in the telega-ins--animated-emoji-msg function before deciding how to render the emoji:

;; Check if emoji images should be used
    (if (not telega-emoji-use-images)
        ;; If emoji images disabled, just insert as text
        (telega-ins emoji)

original function:

telega.el/telega-ins.el

Lines 1575 to 1589 in ff06f58

(defun telega-ins--animated-emoji-msg (msg)
"Inserter for the \"messageAnimatedEmoji\" MSG."
(let* ((content (plist-get msg :content))
(emoji (telega-tl-str content :emoji))
(animated-emoji (plist-get content :animated_emoji))
(sticker (plist-get animated-emoji :sticker))
(fs-sticker (plist-get msg :telega-sticker-fullscreen)))
(when (and fs-sticker
(plist-get fs-sticker :telega-ffplay-frame-filename))
(setq sticker fs-sticker))
;; NOTE: sticker might be nil if yet unknown for a custom emoji.
;; In this case we insert emoji instead
(if sticker
(telega-ins--sticker-image sticker 'slices)
(telega-ins emoji))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions