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
|
### Extra included plugins
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>194 additional plugins</summary>
|
<summary>195 additional plugins</summary>
|
||||||
|
|
||||||
### All Platforms
|
### All Platforms
|
||||||
|
|
||||||
|
|
@ -151,6 +151,7 @@ You can join our [discord server](https://discord.gg/equicord-117327988606502929
|
||||||
- ReplyPingControl by ant0n & MrDiamond
|
- ReplyPingControl by ant0n & MrDiamond
|
||||||
- RPCEditor by Nyako & nin0dev
|
- RPCEditor by Nyako & nin0dev
|
||||||
- RPCStats by Samwich
|
- RPCStats by Samwich
|
||||||
|
- SaveFavoriteGIFs by thororen
|
||||||
- SearchFix by Jaxx
|
- SearchFix by Jaxx
|
||||||
- SekaiStickers by MaiKokain
|
- SekaiStickers by MaiKokain
|
||||||
- ServerSearch by camila314
|
- ServerSearch by camila314
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { addChatBarButton, ChatBarButton, ChatBarButtonFactory, removeChatBarButton } from "@api/ChatButtons";
|
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
|
||||||
import {
|
import {
|
||||||
ApplicationCommandInputType,
|
ApplicationCommandInputType,
|
||||||
ApplicationCommandOptionType,
|
ApplicationCommandOptionType,
|
||||||
|
|
@ -150,6 +150,7 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
renderChatBarButton: ChatBarIcon,
|
||||||
async interactionHandler(interaction) {
|
async interactionHandler(interaction) {
|
||||||
const sender = await UserUtils.getUser(interaction.application_id).catch(() => null);
|
const sender = await UserUtils.getUser(interaction.application_id).catch(() => null);
|
||||||
if (!sender || (sender.bot === true && sender.id !== "1")) return;
|
if (!sender || (sender.bot === true && sender.id !== "1")) return;
|
||||||
|
|
@ -260,7 +261,6 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
async start() {
|
async start() {
|
||||||
addChatBarButton("Encryptcord", ChatBarIcon);
|
|
||||||
const pair = await generateKeys();
|
const pair = await generateKeys();
|
||||||
await DataStore.set("encryptcordPublicKey", pair.publicKey);
|
await DataStore.set("encryptcordPublicKey", pair.publicKey);
|
||||||
await DataStore.set("encryptcordPrivateKey", pair.privateKey);
|
await DataStore.set("encryptcordPrivateKey", pair.privateKey);
|
||||||
|
|
@ -272,7 +272,6 @@ export default definePlugin({
|
||||||
await DataStore.set("encryptcordGroupMembers", {});
|
await DataStore.set("encryptcordGroupMembers", {});
|
||||||
},
|
},
|
||||||
async stop() {
|
async stop() {
|
||||||
removeChatBarButton("Encryptcord");
|
|
||||||
if (await DataStore.get("encryptcordGroup") === true) {
|
if (await DataStore.get("encryptcordGroup") === true) {
|
||||||
await leave("", { channel: { id: await DataStore.get("encryptcordChannelId") } });
|
await leave("", { channel: { id: await DataStore.get("encryptcordChannelId") } });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* 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 { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
|
||||||
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||||
import { addMessagePreSendListener, MessageSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
import { addMessagePreSendListener, MessageSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||||
|
|
@ -287,14 +287,13 @@ export default definePlugin({
|
||||||
contextMenus: {
|
contextMenus: {
|
||||||
"textarea-context": ChatBarContextCheckbox
|
"textarea-context": ChatBarContextCheckbox
|
||||||
},
|
},
|
||||||
|
renderChatBarButton: FurudoSpeakChatToggle,
|
||||||
|
|
||||||
start: () => {
|
start: () => {
|
||||||
addChatBarButton("FurudoSpeak", FurudoSpeakChatToggle);
|
|
||||||
messageSendListenerFuncs();
|
messageSendListenerFuncs();
|
||||||
},
|
},
|
||||||
|
|
||||||
stop: () => {
|
stop: () => {
|
||||||
removeChatBarButton("FurudoSpeak");
|
|
||||||
removeMessagePreSendListener(presendObject);
|
removeMessagePreSendListener(presendObject);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* 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 { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import { EquicordDevs } from "@utils/constants";
|
import { EquicordDevs } from "@utils/constants";
|
||||||
|
|
@ -96,12 +96,11 @@ export default definePlugin({
|
||||||
description: "Suffixes 'ington' to a random word in your message",
|
description: "Suffixes 'ington' to a random word in your message",
|
||||||
authors: [EquicordDevs.zyqunix],
|
authors: [EquicordDevs.zyqunix],
|
||||||
settings,
|
settings,
|
||||||
|
renderChatBarButton: IngtoninatorButton,
|
||||||
start() {
|
start() {
|
||||||
addChatBarButton("Ingtoninator", IngtoninatorButton);
|
|
||||||
addMessagePreSendListener(handleMessage);
|
addMessagePreSendListener(handleMessage);
|
||||||
},
|
},
|
||||||
stop() {
|
stop() {
|
||||||
removeChatBarButton("Ingtoninator");
|
|
||||||
removeMessagePreSendListener(handleMessage);
|
removeMessagePreSendListener(handleMessage);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* 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 { Devs } from "@utils/constants";
|
||||||
import { getCurrentChannel, sendMessage } from "@utils/discord";
|
import { getCurrentChannel, sendMessage } from "@utils/discord";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
@ -28,6 +28,5 @@ export default definePlugin({
|
||||||
description: "Adds a chatbar button to meow in chat",
|
description: "Adds a chatbar button to meow in chat",
|
||||||
authors:
|
authors:
|
||||||
[Devs.Samwich],
|
[Devs.Samwich],
|
||||||
start: () => addChatBarButton("Meow", ChatBarIcon),
|
renderChatBarButton: ChatBarIcon,
|
||||||
stop: () => removeChatBarButton("Meow")
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
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
|
* 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 { definePluginSettings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { openModal } from "@utils/modal";
|
import { openModal } from "@utils/modal";
|
||||||
|
|
@ -36,7 +36,8 @@ export default definePlugin({
|
||||||
authors: [Devs.MaiKokain],
|
authors: [Devs.MaiKokain],
|
||||||
dependencies: ["ChatInputButtonAPI"],
|
dependencies: ["ChatInputButtonAPI"],
|
||||||
settings,
|
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" }];
|
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) {
|
if (!IS_FONTS_LOADED) {
|
||||||
fonts.map(n => {
|
fonts.map(n => {
|
||||||
|
|
@ -47,7 +48,5 @@ export default definePlugin({
|
||||||
});
|
});
|
||||||
IS_FONTS_LOADED = true;
|
IS_FONTS_LOADED = true;
|
||||||
}
|
}
|
||||||
addChatBarButton("SekaiStickers", SekaiStickerChatButton);
|
|
||||||
},
|
},
|
||||||
stop: () => removeChatBarButton("SekaiStickers")
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* 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 { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
|
||||||
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||||
import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||||
|
|
@ -106,15 +106,14 @@ export default definePlugin({
|
||||||
description: "Automated fingerprint/end text",
|
description: "Automated fingerprint/end text",
|
||||||
authors: [Devs.Ven, Devs.Rini, Devs.ImBanana, EquicordDevs.KrystalSkull],
|
authors: [Devs.Ven, Devs.Rini, Devs.ImBanana, EquicordDevs.KrystalSkull],
|
||||||
dependencies: ["MessageEventsAPI", "ChatInputButtonAPI"],
|
dependencies: ["MessageEventsAPI", "ChatInputButtonAPI"],
|
||||||
|
renderChatBarButton: SignatureToggle,
|
||||||
|
|
||||||
start: () => {
|
start: () => {
|
||||||
if (settings.store.isEnabled) true;
|
if (settings.store.isEnabled) true;
|
||||||
addChatBarButton("Signature", SignatureToggle);
|
|
||||||
addMessagePreSendListener(handleMessage);
|
addMessagePreSendListener(handleMessage);
|
||||||
},
|
},
|
||||||
stop: () => {
|
stop: () => {
|
||||||
if (settings.store.isEnabled) false;
|
if (settings.store.isEnabled) false;
|
||||||
removeChatBarButton("Signature");
|
|
||||||
removeMessagePreSendListener(handleMessage);
|
removeMessagePreSendListener(handleMessage);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* 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 { addMessagePreSendListener, MessageSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||||
import { EquicordDevs } from "@utils/constants";
|
import { EquicordDevs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
@ -59,7 +59,5 @@ export default definePlugin({
|
||||||
authors: [EquicordDevs.Tolgchu],
|
authors: [EquicordDevs.Tolgchu],
|
||||||
description: "Reverses the message content before sending it.",
|
description: "Reverses the message content before sending it.",
|
||||||
dependencies: ["MessageEventsAPI", "ChatInputButtonAPI"],
|
dependencies: ["MessageEventsAPI", "ChatInputButtonAPI"],
|
||||||
|
renderChatBarButton: ReverseMessageToggle,
|
||||||
start: () => addChatBarButton("ReverseMessageToggle", ReverseMessageToggle),
|
|
||||||
stop: () => removeChatBarButton("ReverseMessageToggle")
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* 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 { Devs } from "@utils/constants";
|
||||||
import { getCurrentChannel, sendMessage } from "@utils/discord";
|
import { getCurrentChannel, sendMessage } from "@utils/discord";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
@ -27,6 +27,5 @@ export default definePlugin({
|
||||||
name: "Woof",
|
name: "Woof",
|
||||||
description: "Adds a chatbar button to woof in chat",
|
description: "Adds a chatbar button to woof in chat",
|
||||||
authors: [Devs.Samwich],
|
authors: [Devs.Samwich],
|
||||||
start: () => addChatBarButton("Woof", ChatBarIcon),
|
renderChatBarButton: ChatBarIcon,
|
||||||
stop: () => removeChatBarButton("Woof")
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue