Add SaveFavoriteGIFs
This commit is contained in:
parent
fbf0358264
commit
5f75ebaab4
10 changed files with 80 additions and 27 deletions
|
|
@ -11,7 +11,7 @@ You can join our [discord server](https://discord.gg/equicord-117327988606502929
|
|||
### Extra included plugins
|
||||
|
||||
<details>
|
||||
<summary>194 additional plugins</summary>
|
||||
<summary>195 additional plugins</summary>
|
||||
|
||||
### All Platforms
|
||||
|
||||
|
|
@ -151,6 +151,7 @@ You can join our [discord server](https://discord.gg/equicord-117327988606502929
|
|||
- ReplyPingControl by ant0n & MrDiamond
|
||||
- RPCEditor by Nyako & nin0dev
|
||||
- RPCStats by Samwich
|
||||
- SaveFavoriteGIFs by thororen
|
||||
- SearchFix by Jaxx
|
||||
- SekaiStickers by MaiKokain
|
||||
- ServerSearch by camila314
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { addChatBarButton, ChatBarButton, ChatBarButtonFactory, removeChatBarButton } from "@api/ChatButtons";
|
||||
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
|
||||
import {
|
||||
ApplicationCommandInputType,
|
||||
ApplicationCommandOptionType,
|
||||
|
|
@ -150,6 +150,7 @@ export default definePlugin({
|
|||
}
|
||||
}
|
||||
],
|
||||
renderChatBarButton: ChatBarIcon,
|
||||
async interactionHandler(interaction) {
|
||||
const sender = await UserUtils.getUser(interaction.application_id).catch(() => null);
|
||||
if (!sender || (sender.bot === true && sender.id !== "1")) return;
|
||||
|
|
@ -260,7 +261,6 @@ export default definePlugin({
|
|||
},
|
||||
],
|
||||
async start() {
|
||||
addChatBarButton("Encryptcord", ChatBarIcon);
|
||||
const pair = await generateKeys();
|
||||
await DataStore.set("encryptcordPublicKey", pair.publicKey);
|
||||
await DataStore.set("encryptcordPrivateKey", pair.privateKey);
|
||||
|
|
@ -272,7 +272,6 @@ export default definePlugin({
|
|||
await DataStore.set("encryptcordGroupMembers", {});
|
||||
},
|
||||
async stop() {
|
||||
removeChatBarButton("Encryptcord");
|
||||
if (await DataStore.get("encryptcordGroup") === true) {
|
||||
await leave("", { channel: { id: await DataStore.get("encryptcordChannelId") } });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { addChatBarButton, ChatBarButton, ChatBarButtonFactory, removeChatBarButton } from "@api/ChatButtons";
|
||||
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
|
||||
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
|
||||
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||
import { addMessagePreSendListener, MessageSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||
|
|
@ -287,14 +287,13 @@ export default definePlugin({
|
|||
contextMenus: {
|
||||
"textarea-context": ChatBarContextCheckbox
|
||||
},
|
||||
renderChatBarButton: FurudoSpeakChatToggle,
|
||||
|
||||
start: () => {
|
||||
addChatBarButton("FurudoSpeak", FurudoSpeakChatToggle);
|
||||
messageSendListenerFuncs();
|
||||
},
|
||||
|
||||
stop: () => {
|
||||
removeChatBarButton("FurudoSpeak");
|
||||
removeMessagePreSendListener(presendObject);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { addChatBarButton, ChatBarButton, ChatBarButtonFactory, removeChatBarButton } from "@api/ChatButtons";
|
||||
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
|
||||
import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
|
|
@ -96,12 +96,11 @@ export default definePlugin({
|
|||
description: "Suffixes 'ington' to a random word in your message",
|
||||
authors: [EquicordDevs.zyqunix],
|
||||
settings,
|
||||
renderChatBarButton: IngtoninatorButton,
|
||||
start() {
|
||||
addChatBarButton("Ingtoninator", IngtoninatorButton);
|
||||
addMessagePreSendListener(handleMessage);
|
||||
},
|
||||
stop() {
|
||||
removeChatBarButton("Ingtoninator");
|
||||
removeMessagePreSendListener(handleMessage);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { addChatBarButton, ChatBarButton, ChatBarButtonFactory, removeChatBarButton } from "@api/ChatButtons";
|
||||
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getCurrentChannel, sendMessage } from "@utils/discord";
|
||||
import definePlugin from "@utils/types";
|
||||
|
|
@ -28,6 +28,5 @@ export default definePlugin({
|
|||
description: "Adds a chatbar button to meow in chat",
|
||||
authors:
|
||||
[Devs.Samwich],
|
||||
start: () => addChatBarButton("Meow", ChatBarIcon),
|
||||
stop: () => removeChatBarButton("Meow")
|
||||
renderChatBarButton: ChatBarIcon,
|
||||
});
|
||||
|
|
|
|||
61
src/equicordplugins/saveFavoriteGIFs/index.tsx
Normal file
61
src/equicordplugins/saveFavoriteGIFs/index.tsx
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2025 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
|
||||
import { showNotification } from "@api/Notifications";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { saveFile } from "@utils/web";
|
||||
import { findComponentByCodeLazy } from "@webpack";
|
||||
import { UserSettingsActionCreators } from "@webpack/common";
|
||||
|
||||
const StarIcon = findComponentByCodeLazy(".73-2.25h6.12l1.9-5.83Z");
|
||||
|
||||
async function saveGifs() {
|
||||
const filename = `favorite-gifs-${new Date().toISOString().split("T")[0]}.txt`;
|
||||
const gifUrls = Object.keys(UserSettingsActionCreators.FrecencyUserSettingsActionCreators.getCurrentValue().favoriteGifs.gifs);
|
||||
const content = gifUrls.join("\n");
|
||||
|
||||
try {
|
||||
if (IS_DISCORD_DESKTOP) {
|
||||
const data = new TextEncoder().encode(content);
|
||||
await DiscordNative.fileManager.saveWithDialog(data, filename);
|
||||
} else {
|
||||
const file = new File([content], filename, { type: "text/plain" });
|
||||
saveFile(file);
|
||||
}
|
||||
|
||||
showNotification({
|
||||
title: "Save Favorite GIFs",
|
||||
body: `Saved GIFs successfully as ${filename}`,
|
||||
});
|
||||
} catch (error) {
|
||||
showNotification({
|
||||
title: "Save Favorite GIFs",
|
||||
body: "Failed to save GIFs",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const button: ChatBarButtonFactory = ({ isMainChat }) => {
|
||||
if (!isMainChat) return null;
|
||||
|
||||
return (
|
||||
<ChatBarButton
|
||||
tooltip={"Save Favorite GIFs"}
|
||||
onClick={() => saveGifs()}
|
||||
>
|
||||
<StarIcon height={18} width={18} />
|
||||
</ChatBarButton>
|
||||
);
|
||||
};
|
||||
|
||||
export default definePlugin({
|
||||
name: "SaveFavoriteGIFs",
|
||||
description: "Save favorite GIF urls to a file",
|
||||
authors: [EquicordDevs.thororen],
|
||||
renderChatBarButton: button,
|
||||
});
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { addChatBarButton, ChatBarButton, ChatBarButtonFactory, removeChatBarButton } from "@api/ChatButtons";
|
||||
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { openModal } from "@utils/modal";
|
||||
|
|
@ -36,7 +36,8 @@ export default definePlugin({
|
|||
authors: [Devs.MaiKokain],
|
||||
dependencies: ["ChatInputButtonAPI"],
|
||||
settings,
|
||||
start: async () => {
|
||||
renderChatBarButton: SekaiStickerChatButton,
|
||||
async start() {
|
||||
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" }];
|
||||
if (!IS_FONTS_LOADED) {
|
||||
fonts.map(n => {
|
||||
|
|
@ -47,7 +48,5 @@ export default definePlugin({
|
|||
});
|
||||
IS_FONTS_LOADED = true;
|
||||
}
|
||||
addChatBarButton("SekaiStickers", SekaiStickerChatButton);
|
||||
},
|
||||
stop: () => removeChatBarButton("SekaiStickers")
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { addChatBarButton, ChatBarButton, ChatBarButtonFactory, removeChatBarButton } from "@api/ChatButtons";
|
||||
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
|
||||
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
|
||||
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||
import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||
|
|
@ -106,15 +106,14 @@ export default definePlugin({
|
|||
description: "Automated fingerprint/end text",
|
||||
authors: [Devs.Ven, Devs.Rini, Devs.ImBanana, EquicordDevs.KrystalSkull],
|
||||
dependencies: ["MessageEventsAPI", "ChatInputButtonAPI"],
|
||||
renderChatBarButton: SignatureToggle,
|
||||
|
||||
start: () => {
|
||||
if (settings.store.isEnabled) true;
|
||||
addChatBarButton("Signature", SignatureToggle);
|
||||
addMessagePreSendListener(handleMessage);
|
||||
},
|
||||
stop: () => {
|
||||
if (settings.store.isEnabled) false;
|
||||
removeChatBarButton("Signature");
|
||||
removeMessagePreSendListener(handleMessage);
|
||||
|
||||
},
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { addChatBarButton, ChatBarButton, ChatBarButtonFactory, removeChatBarButton } from "@api/ChatButtons";
|
||||
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
|
||||
import { addMessagePreSendListener, MessageSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
|
|
@ -59,7 +59,5 @@ export default definePlugin({
|
|||
authors: [EquicordDevs.Tolgchu],
|
||||
description: "Reverses the message content before sending it.",
|
||||
dependencies: ["MessageEventsAPI", "ChatInputButtonAPI"],
|
||||
|
||||
start: () => addChatBarButton("ReverseMessageToggle", ReverseMessageToggle),
|
||||
stop: () => removeChatBarButton("ReverseMessageToggle")
|
||||
renderChatBarButton: ReverseMessageToggle,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { addChatBarButton, ChatBarButton, ChatBarButtonFactory, removeChatBarButton } from "@api/ChatButtons";
|
||||
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getCurrentChannel, sendMessage } from "@utils/discord";
|
||||
import definePlugin from "@utils/types";
|
||||
|
|
@ -27,6 +27,5 @@ export default definePlugin({
|
|||
name: "Woof",
|
||||
description: "Adds a chatbar button to woof in chat",
|
||||
authors: [Devs.Samwich],
|
||||
start: () => addChatBarButton("Woof", ChatBarIcon),
|
||||
stop: () => removeChatBarButton("Woof")
|
||||
renderChatBarButton: ChatBarIcon,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue