2024-04-17 14:29:47 -04:00
|
|
|
/*
|
|
|
|
* Vencord, a Discord client mod
|
|
|
|
* Copyright (c) 2024 Vendicated and contributors
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons";
|
2024-07-13 00:20:46 -04:00
|
|
|
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
|
2024-04-17 14:29:47 -04:00
|
|
|
import { Devs } from "@utils/constants";
|
|
|
|
import { openModal } from "@utils/modal";
|
|
|
|
import definePlugin, { OptionType } from "@utils/types";
|
|
|
|
|
|
|
|
import SekaiStickersModal from "./Components/SekaiStickersModal";
|
|
|
|
import { kanadeSvg } from "./kanade.svg";
|
|
|
|
|
|
|
|
const settings = definePluginSettings({
|
|
|
|
AutoCloseModal: {
|
|
|
|
type: OptionType.BOOLEAN,
|
|
|
|
description: "Auto close modal when done",
|
|
|
|
default: true
|
2024-06-01 14:32:22 -04:00
|
|
|
}
|
2024-04-17 14:29:47 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
const SekaiStickerChatButton: ChatBarButton = () => {
|
|
|
|
return (
|
|
|
|
<ChatBarButton onClick={() => openModal(props => <SekaiStickersModal modalProps={props} settings={settings} />)} tooltip="Sekai Stickers">
|
|
|
|
{kanadeSvg()}
|
|
|
|
</ChatBarButton>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
let IS_FONTS_LOADED = false;
|
2024-07-13 00:20:46 -04:00
|
|
|
migratePluginSettings("SekaiStickers", "Sekai Stickers");
|
2024-04-17 14:29:47 -04:00
|
|
|
export default definePlugin({
|
2024-07-13 00:20:46 -04:00
|
|
|
name: "SekaiStickers",
|
2024-04-17 14:29:47 -04:00
|
|
|
description: "Sekai Stickers built in discord originally from github.com/TheOriginalAyaka",
|
|
|
|
authors: [Devs.MaiKokain],
|
|
|
|
dependencies: ["ChatInputButtonAPI"],
|
|
|
|
settings,
|
|
|
|
start: async () => {
|
2024-07-31 15:52:34 -04:00
|
|
|
const fonts = [{ name: "YurukaStd", url: "https://raw.githubusercontent.com/TheOriginalAyaka/sekai-stickers/47a2ca33b8cb35f59800e8faad48980e4ce5ea71/src/fonts/YurukaStd.woff2" }, { name: "SSFangTangTi", url: "https://raw.githubusercontent.com/TheOriginalAyaka/sekai-stickers/main/src/fonts/ShangShouFangTangTi.woff2" }];
|
2024-04-17 14:29:47 -04:00
|
|
|
if (!IS_FONTS_LOADED) {
|
|
|
|
fonts.map(n => {
|
|
|
|
new FontFace(n.name, `url(${n.url})`).load().then(
|
|
|
|
font => { document.fonts.add(font); },
|
|
|
|
err => { console.log(err); }
|
|
|
|
);
|
|
|
|
});
|
|
|
|
IS_FONTS_LOADED = true;
|
|
|
|
}
|
|
|
|
addChatBarButton("SekaiStickers", SekaiStickerChatButton);
|
|
|
|
},
|
|
|
|
stop: () => removeChatBarButton("SekaiStickers")
|
|
|
|
});
|