Last active
July 31, 2025 08:38
-
-
Save neoboyser/651cae2cb58e4b67b764678a4874b09b to your computer and use it in GitHub Desktop.
Sticker converter module for RaganorkMD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { Module } = require("../main"); | |
| const config = require("../config"); | |
| const { Sticker, StickerTypes } = require("wa-sticker-formatter"); | |
| const fromMe = config.MODE !== "public"; | |
| Module({ | |
| pattern: "sticker ?(.*)", | |
| fromMe, | |
| desc: "Convert image or short video to sticker", | |
| use: "media", | |
| }, async (message, match) => { | |
| const quoted = message.reply_message; | |
| // Validate input | |
| if (!quoted || (!quoted.image && !quoted.video)) { | |
| return await message.sendReply("⚠️ Reply to an *image* or *short video* to create a sticker."); | |
| } | |
| try { | |
| // Download media | |
| const mediaBuffer = await quoted.download(); | |
| // Create sticker instance | |
| const sticker = new Sticker(mediaBuffer, { | |
| pack: "RaganorkMD", | |
| author: "@xchup", | |
| type: quoted.image ? StickerTypes.FULL : StickerTypes.CROPPED, | |
| quality: 70, | |
| }); | |
| // Convert to buffer | |
| const stickerBuffer = await sticker.toBuffer(); | |
| // Send sticker | |
| await message.send(stickerBuffer, "sticker", { | |
| quoted: message.data, | |
| }); | |
| } catch (err) { | |
| console.error("❌ Sticker creation failed:", err); | |
| await message.sendReply("❌ Failed to create sticker. Make sure it's a short video (<10s) or a valid image."); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment