Reverse Engineering Telegram -Random Animated Emojis

Chris Schnabl
3 min readApr 25, 2020

I have adopted Telegram as the casual messaging service of my choice around five years ago and deprecated my Whatsapp account. Ever since I have been fascinated about all the nitty gritty funny details the engineers have come up release for release.

Bull’s eye!

One of the recent additions being Emojis animated on the client-side based on a random number. This started with the dice emoji landing on one of its six sides based on a random number (from 1 to 6). The meaning of the random numbers is obvious for the dice emoji. However, for the dart emoji the mapping is as follows:

  • 1: Miss
  • 2: Upper Left Corner (First outer ring, red)
  • 3: Right Lower Corner (Second outer ring, white)
  • 4: Left Lower Corner (Third outer ring, red)
  • 5: Middle Top (Fourth outer ring, white)
  • 6: Bull’s Eye

The feature is implemented by sending the emoji + the obtained random number to each client and rendering the respective animation locally.

Dice messages swap the `text` key for the `dice` key and contain the emoji to be animated, as well as the generated random number as you can see in the code snippets below:

Normal chat text message vs. dice message

You can also see another cool feature here, the embedded emoji search. I am agnostic when it comes to messaging, meaning I want to express my thoughts as concise and efficient as possible without having to spend countless of seconds searching for the “right” emoji. On the other hand sometimes using such makes a conversation feel less cold and wouldn't it be for the embedded search I would never send emojis at all.

The moment I read through the release notes and noticed the dart feature I was eager to find out how the probabilities are distributed. But then I found out that internally just the same old mechanism, known from the dices, was used and that the pin takes one out of the six positions.

If any Telegram Engineer is reading this — I challenge you to come up with a new mechanism for other emojis for me to have more fun reverse engineering them.

Some suggestions for other non-deterministic emojis:

  • ☕️ — A coffee mug that gets filled at a certain speed to a certain volume.
  • 🌩 — A lighting that takes some time before striking to find out how far the storm is still away.
  • 📆 — The calendar item reflecting the current date.
  • 🧠 — The brain growing to a certain size with the size normal distributed to reflect the IQ scale.
  • 🌕 — The moon emoji animating the current moon phase.
  • 🌍 — Spinning the earth and stopping at the users current location.
  • 🎰 — I wanna gamble!!!

PS: It took some effort to switch from dark mode just for this post :D

--

--