diff --git a/index.tsx b/index.tsx index 8348d66..5182e2e 100644 --- a/index.tsx +++ b/index.tsx @@ -1,3 +1,5 @@ +/* eslint-disable simple-header/header */ +/* eslint-disable indent */ /* * Vencord, a modification for Discord's desktop app * Copyright (c) 2023 your mom lol @@ -16,13 +18,14 @@ * along with this program. If not, see . */ -import definePlugin from "@utils/types"; import { addButton, removeButton } from "@api/MessagePopover"; -import { ChannelStore } from "@webpack/common"; -import { PropsWithChildren } from "react"; - +import { definePluginSettings } from "@api/Settings"; import { classes } from "@utils/misc"; +import definePlugin, { OptionType } from "@utils/types"; +import { ChannelStore, RestAPI } from "@webpack/common"; import type { SVGProps } from "react"; +// eslint-disable-next-line no-duplicate-imports +import { PropsWithChildren } from "react"; interface BaseIconProps extends IconProps { @@ -68,12 +71,24 @@ export function Husk(props: IconProps) { export default definePlugin({ name: "Husk", - description: "Adds husk button (works only on the Vencord Server if no nitro)", + description: "Adds Husk button (check settings to change used emoji)", authors: [{ name: "nina", id: 886685857560539176n }], dependencies: ["MessagePopoverAPI"], + settings: definePluginSettings({ + emojiName: { + description: "Default (from Vencord Server): husk", + type: OptionType.STRING, + default: "husk" + }, + emojiID: { + description: "Default (from Vencord Server): 1026532993923293184", + type: OptionType.BIGINT, + default: 1026532993923293184n + } + }), async start() { addButton("Husk", msg => { @@ -82,7 +97,12 @@ export default definePlugin({ icon: Husk, message: msg, channel: ChannelStore.getChannel(msg.channel_id), - onClick: () => Vencord.Webpack.findByProps("addReaction").addReaction(msg.channel_id, msg.id, {id: '1026532993923293184', name: 'husk', animated: false}) + onClick: () => { + RestAPI.put({ + url: `/channels/${msg.channel_id}/messages/${msg.id}/reactions/${this.settings.store.emojiName}:${this.settings.store.emojiID}/@me` + } + ); + } }; }); }, @@ -91,4 +111,4 @@ export default definePlugin({ removeButton("Husk"); }, -}); \ No newline at end of file +});