Stickers
Declare stickers, together with attachments, to let the user turn an image or GIF from a message into a community sticker. Your plugin adds the right-click item and hands its handle to stickers.add. FluxPlugs draws the Add sticker dialog, lists the communities where the user may add stickers, and uploads the sticker when they choose Create. Your plugin never sees the community list, the image or the user’s credential.
Open the dialog
Section titled “Open the dialog”cleanup.push( await api.attachments.registerContextAction( { id: "add-sticker", label: "Add as sticker", kinds: ["image", "gif"] }, async (context) => { try { const added = await api.stickers.add({ attachment: context.handle }); if (added) api.logger.info("Sticker added", { guildId: added.guildId }); } catch { await api.ui.notify("Right-click the image again."); } }, ),);stickers.add({ attachment, name? }) resolves { guildId } with the community the sticker went to, or null when the user closes the dialog. name is where the dialog’s Name field starts; the user can change it, and it defaults to a name made from the file’s.
- Call it within 10 seconds of the right-click, or right after a user action in your plugin’s own UI. Otherwise it fails with user_gesture_required.
- Each right-click opens the dialog once (attachment_context_used), and only one dialog is open at a time (stickers_busy).
- File cards don’t work (sticker_needs_image); register the action with kinds
["image", "gif"]. - Handles expire as described in posted-file actions.
What the dialog does
Section titled “What the dialog does”- The image. A posted file is downloaded from its own address. A GIF sent from the GIF picker plays as a video in Fluxer, so FluxPlugs asks Fluxer for its GIF files, the same lookup Fluxer’s favourites use, and takes the biggest one under Fluxer’s 512 KB limit. Still images are fitted into 320×320 pixels.
- Too big. When an animated image is over the limit, the dialog offers to make a smaller copy and warns that it can look choppier or blotchier. Nothing is shrunk unless the user asks.
- Communities. Only the ones where Fluxer says the user has the Create expressions or Administrator permission. When Fluxer doesn’t say, all of them are listed, and Fluxer refuses the upload where the user isn’t allowed.
- Fields. Name (2 to 30 characters), an optional description of up to 500 characters and up to 10 tags.
- Errors. A full community, a missing permission, a rate limit or a refused image is explained in the dialog, which stays open so the user can change something and try again.
FluxPlugs is an independent project, not affiliated with or endorsed by Fluxer.