ChristopherBThai / Discord-OwO-Bot

A Discord bot that will keep track of your OwO
https://discordapp.com/oauth2/authorize?client_id=408785106942164992&permissions=1074120776&scope=bot
Other
560 stars 404 forks source link

Grab sticker #333

Open Nikhil0108L opened 1 year ago

Nikhil0108L commented 1 year ago

Add a cmd so we can also grab a sticker like a emoji

azurenekowo commented 1 year ago

You can grab custom (server-uploaded stickers) because they are stored in image formats. Not with built-in stickers like the Wumpus pack and such... they use Lottie and trying to grab them only results in an unreadable .json file.

As for custom stickers, https://cdn.discordapp.com/stickers/[sticker id].png?size=1024

/*
/   Not enough explaination?
*/

Click away if you have nerdphobia: (This was copied from https://codingwithmitch.com/blog/understanding-the-internals-of-lottie-rendering-the-animation-file/)

Lottie is a library for Android, iOS, Web, and Windows that parses Adobe After Effects animations exported as json with Bodymovin and renders them natively on mobile and on the web.

Early days of Dynamic Animation

In the year 2014 with the release of Android 5.0 (API 21) Lollipop, Android supported Vector Drawables and Animated Vector Drawables.

But even with the support for Animated Vector Drawables, making dynamic vector animation was not easy. It couldn't be loaded programmatically or over the internet. Moreover, it had issues with resolving vector path transformation animation in Android 4.x.

Producing Animation

Some other ways to produce the animation effect were:

The direct consequence of the above is that there was not a hint of dynamic vector animation in almost all the major apps, but until the emergence of Lottie.

Emergence of Lottie

Lottie is an animation rendering library open-sourced by Airbnb. With Android, it also supports iOS, React Native, Windows, and Web platforms. Lottie currently supports rendering and playing After Effects animations. Lottie uses the JSON data exported by bodymovin, an After Effects plug-in as the animation data source.

Designers use After Effects to make animations and export JSON files. We can put the JSON file on the svg-sprite Lottie-Player and run it to see the effect. The resources used by Lottie need to first convert the aep (After Effects Project) file generated by Adobe After Effects into a general JSON format file through bodymovin. bodymovin exports the After Effects animation as a description of the animation, and the job of lottie-android is to translate the described animation with native code, and its core principle is canvas drawing. Lottie's animation is drawn by a pure canvas. image