import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";

const settings = definePluginSettings({
    reactionCount: {
        description: "Number of reactions (0-42)",
        type: OptionType.NUMBER,
        default: 5
    },
});

export default definePlugin({
    name: "MoreQuickReactions",
    description: "Increases the number of reactions available in the Quick React hover menu",
    authors: [Devs.iamme],
    tags: ["Emotes", "Reactions", "Customisation", "Shortcuts"],
    settings,

    get reactionCount() {
        return settings.store.reactionCount;
    },

    patches: [
        {
            find: "#{intl::MESSAGE_UTILITIES_A11Y_LABEL}",
            replacement: {
                match: /(?<=length>=3\?.{0,40})\.slice\(0,3\)/,
                replace: ".slice(0,$self.reactionCount)"
            }
        }
    ],
});
