David Martínez-Rubio bio photo

David Martínez-Rubio

  G. Scholar LinkedIn Github e-Mail

I made @tokipona_bot in 2020 to make writing sitelen pona easy inside Telegram chats. The bot works in inline mode: you write the bot name, then your Toki Pona sentence, and finish it with a slash.

@tokipona_bot ni li pona mute tawa mi /

After the slash, Telegram shows the generated image; you tap it, and the sitelen pona version is sent to the chat. You can also add line breaks, so the result can be formatted as more than a single horizontal sentence. If not, it goes to the next line after 10 symbols.

You can choose among several different fonts, and colors. There are also small conveniences for common sitelen pona notation. You can write compound glyphs by joining words, such as tokipona for example:

@tokipona_bot tokipona li pona tawa mi /

Tapping sends the following:

For proper names, you can draw a cartouche by surrounding words with square brackets, or write a capitalized Toki Pona name and let the bot spell it with random symbols.

@tokipona_bot ma [kasi alasa nasin awen telo a] li suli /
@tokipona_bot ma [Kanata] li suli /

The implementation has one Telegram-specific trick I had to figure out. Inline bots cannot directly return arbitrary freshly generated images unless Telegram already has the media, so the bot first sends the generated image to a private “magic chat”, uses that Telegram-hosted file for the inline result, and then deletes it. The images are taken from the Linja Pona renderer at lp.plop.me: the bot builds a URL containing the text, font, color, background, and output format, then lets Telegram fetch that rendered sticker or photo.

The code is on GitHub.