Set up a virtual environment and install lottie along with its deps.
python -m venv .venv
source venv/bin/activate
pip install lottie pillow cairosvgIt's now as simple as running lottie_convert over the downloaded sticker.
lottie_convert.py AnimatedSticker.tgs sticker.gif<rant>
As much as I hate this absolute abomination of a format known as GIF, it's often the one and only thing that will get your point across in conversations.
Imagine this situation. You remember that one sticker on Telegram that is perfect for your current situation. You rush to open Telegram, right-click on it and choose "Download", then realize what instead got downloaded is a file with .tgs extension that you've never before heard about in 5 years of CS course. You quickly open a google search and there's no actual documentation on the said format. Instead, every search result is either about hosting a Telegram bot yourself, or sending your sticker to a bot that responds with a completely messed up GIF, or even worse -- watching normies solve it by "recording their screen with the sticker playing". You're filled with rage that nobody has known before. Yes, that's precisely what happened to me :D
If only I knew from the beginning that these .tgs files are basically your typical JSON data compressed with gzip, I wouldn't have needed to lose my mind over it. More canonically, these are called Lottie animation format. You can even inspect what's inside if you want.
$ file AnimatedSticker.tgs
AnimatedSticker.tgs: gzip compressed data, max compression, from Unix, original size modulo 2^32 33787gunzip --stdout AnimatedSticker.tgs | jq -C | less -FR</rant>