Ibiyemi Abiodun

« main page

Reaction Bot

Bringing emoji reactions to Telegram GitHub repository

March 2020 to October 2020

rusttelegram-api

I’ve been using Telegram since 2015. And in 2020, it still didn’t have emoji reactions for messages, so I made a Telegram bot to address the problem.

It worked in group chats. Once added to the group chat, you could use the bot to attach a set of emoji reactions to a message:

The message would dynamically update to keep track of which reactions had been placed on the message:

And you could issue the /s command to find out who had clicked which reaction:

With this project, I wanted to avoid having to manage a database in the event that it gained traction, so I stored the data related to the reactions in the metadata of the buttons instead. The Telegram API allows storing up to 64 bytes of data in an InlineKeyboardButton, so I abused this feature to store the user IDs of the users who clicked on each reaction. This was severely limited, though, because one can only get so creative with storing an unbounded set of data in 64 bytes.

For my next trick, I resorted to storing the reaction data as invisible links in the message. When a user reacted to the message, the bot would scan the message for any of these invisible hyperlinks to see which reactions were already present, and then respond by editing its message so that it contained an invisible hyperlink encoding the reaction. It read

I made the hyperlinks invisible by setting their display text to “◌͏”, also known as U+034F or COMBINING GRAPHEME JOINER. It is a character intended to separate two characters that must not be merged into a single grapheme. It is also invisible in most applications, and not considered a whitespace character, which are the two perfect qualities for using it to make invisible hyperlinks.

Telegram finally introduced native emoji reactions in December 2021, so I took the server for this bot offline. But the code is still there, if you’re interested in contorting the Telegram API in ways that defy its creators.