New plugin CopyStickerLinks: adds Copy/Open Link option to stickers (#3191)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
byeoon 2025-08-07 16:24:13 -04:00 committed by GitHub
parent 7e028267f1
commit 4403aee3c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 188 additions and 69 deletions

View file

@ -1 +1,2 @@
export * from "./commands";
export * from "./messages";

View file

@ -0,0 +1,13 @@
export const enum StickerType {
/** an official sticker in a pack */
STANDARD = 1,
/** a sticker uploaded to a guild for the guild's members */
GUILD = 2
}
export const enum StickerFormatType {
PNG = 1,
APNG = 2,
LOTTIE = 3,
GIF = 4
}

View file

@ -2,6 +2,7 @@ import { CommandOption } from './Commands';
import { User, UserJSON } from '../User';
import { Embed, EmbedJSON } from './Embed';
import { DiscordRecord } from "../Record";
import { StickerFormatType } from "../../../enums";
/**
* TODO: looks like discord has moved over to Date instead of Moment;
@ -92,7 +93,7 @@ export class Message extends DiscordRecord {
reactions: MessageReaction[];
state: string;
stickerItems: {
format_type: number;
format_type: StickerFormatType;
id: string;
name: string;
}[];

View file

@ -0,0 +1,35 @@
import { StickerFormatType, StickerType } from "../../../enums";
interface BaseSticker {
asset: string;
available: boolean;
description: string;
format_type: StickerFormatType;
id: string;
name: string;
sort_value?: number;
/** a comma separated string */
tags: string;
}
export interface PackSticker extends BaseSticker {
pack_id: string;
type: StickerType.STANDARD;
}
export interface GuildSticker extends BaseSticker {
guild_id: string;
type: StickerType.GUILD;
}
export type Sticker = PackSticker | GuildSticker;
export interface PremiumStickerPack {
banner_asset_id?: string;
cover_sticker_id?: string;
description: string;
id: string;
name: string;
sku_id: string;
stickers: PackSticker[];
}

View file

@ -2,3 +2,4 @@ export * from "./Commands";
export * from "./Message";
export * from "./Embed";
export * from "./Emoji";
export * from "./Sticker";

View file

@ -0,0 +1,15 @@
import { FluxStore, GuildSticker, PremiumStickerPack, Sticker } from "..";
export type StickerGuildMap = Map<string, GuildSticker[]>;
export class StickersStore extends FluxStore {
getAllGuildStickers(): StickerGuildMap;
getRawStickersByGuild(): StickerGuildMap;
getPremiumPacks(): PremiumStickerPack[];
getStickerById(id: string): Sticker | undefined;
getStickerPack(id: string): PremiumStickerPack | undefined;
getStickersByGuildId(guildId: string): Sticker[] | undefined;
isPremiumPack(id: string): boolean;
}

View file

@ -11,6 +11,7 @@ export * from "./MessageStore";
export * from "./RelationshipStore";
export * from "./SelectedChannelStore";
export * from "./SelectedGuildStore";
export * from "./StickersStore";
export * from "./ThemeStore";
export * from "./TypingStore";
export * from "./UserProfileStore";